Naturally enough, there is a collection called Databases that opens and creates databases and a Database object that contains the tables of information you'll want to work with. The following summarizes the most important properties and methods:
Databases collection |
|
Open(path to file, Exclusive) |
Open an existing database. |
Create(path to file) |
Create a new database. |
Database object |
|
Close |
Close the database. |
Admin |
Access to DAO Database property |
Tables |
The collection of tables belonging to the database |
Forms |
The collection of forms belonging to the database |
Reports |
The collection of reports belonging to the database |
Queries |
The collection of queries belonging to the database. |
Since the database can only use one database at a time, you can use the Databases collection to create and open a database and then use ActiveDatabase, which is itself just a database object, to do the rest.
For example to open and use a table from a database:
Databases.Open("c:\my documents\mydata.adb", False)
ActiveDatabase.Tables.Open("mytable")
Note the second parameter of the open command is False, which means open the database in shared mode. True would be exclusive (i.e. lock every other user out for that session).
See: Working with tables for details on what to do with tables.