Prev | Current Page 1921 | Next

Michael R. Groh, Joseph C. Stockman, Gavin Powell, and Cary N. Prague

"Access 2007 Bible"

Database
Dim td As DAO.TableDef
On Error GoTo HandleError
???MyDMP.mdb must be opened in exclusive mode so
???that we can manipulate its tables. Use the True
???parameter to tell Jet to open the table exclusively:
Set db = _
OpenDatabase(???C:\My Documents\MyDMP.mdb???, True)
???Set the filter on tblBranchOffices
Set td = db.TableDefs(???tblBranchOffices???)
td.ReplicaFilter = ???BranchID = ???NY??™???
CreateFilter = True
ExitHere:
db.Close
Exit Function
HandleError:
CreateFilter = False
MsgBox Err.Number & ???: ??? & Err.Description
Resume ExitHere
End Function
Again, the code is quite simple. Most of the statements in this function involve opening the database
and handling errors. The ReplicaFilter property can be set only on an open tabledef
object, so you must trap the error that occurs if the tabledef is not available. Also, the On
Error statement at the top of the CreateFilter( ) function traps the error that will occur if
the database cannot be opened exclusively.
You cannot use aggregate expressions, user-defined functions, or subqueries as part of the filter
expression.


Pages:
1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933
Akcesoria komputerowe nowe tagi Do szkoły Kalendarze indywidualne Last minute Jamajka