Collection or Object Properties Methods Constants
Group/Groups
User/Users
Workspace Groups CreateGroup
UserName CreateUser
Users
WorkspaceTypeEnum dbUseODBC
Databases ........................................................................................................
When working with Access data, a DAO Database object represents (no surprise!) an Access data-
base. (For working with other types of data, use the ADO object model.) To reference the current
database, you can use the CurrentDbmethod of the Access Application object, after declaring the
appropriate DAO Database variable, as in the following code:
Dim dbs as DAO.Database
Set dbs = CurrentDb
If you need to reference an external database, use the OpenDatabasemethod, with the name of
an open database as its argument, as in the following code:
Dim dbs As DAO.Database
Dim strDBName As String
strDBName = “E:\Documents\Northwind.mdb”
Set dbs = OpenDatabase(Name:=strDBName)
Once the database is open, you can proceed to work with it, using the Recordsets, QueryDefs, and
TableDefs collections.
Recordsets........................................................................................................
Recordsets are used to manipulate data in Access databases; they represent the records in tables or
queries in a database. There are five types of DAO recordsets, with different properties, as described
in the following sections. Specify the recordset type by using the appropriate constant for the type
argument when creating a recordset, as in the following code:
Set rst = dbs.OpenRecordset(Name:=”tblOrders”, _
Type:=dbOpenDynaset)
Table 5.3 lists the named constants corresponding to the five recordset types (and their numeric
equivalents). These named constants are used in VBA code; some dialects of Visual Basic, such as
Working with Access Data 5