Chapter 15. Programming DAO: Data Definition Language

In our overview of DAO, we noted that Data Access Objects consists of two conceptually distinct components: a data definition language (or DDL), which allows us to create or access some basic database system objects, like databases, table definitions, and indexes; and a data manipulation language (or DML), which allows us to perform the practical operations of adding data (records) to our tables, deleting unwanted data, and modifying existing data. In this chapter, we discuss the data definition language (DDL) aspects of DAO.

Let us begin by noting the following:

  • To indicate variables of a certain type, we will write the type name followed by the suffix Var. For example, DatabaseVar denotes a variable of type Database and TableDefVar denotes a variable of type TableDef.

  • In describing the syntax of certain methods, we will use square brackets ([ ]) to indicate optional items.

  • We will generally give the full syntax of methods, but will only give details on the more common options. Of course, full details are available through the Access Help system.

Creating a Database

Databases are created using the CreateDatabase method of a Workspace object. The general syntax of this method is:

Set DatabaseVar = [WorkspaceVar.]CreateDatabase _
(DatabaseName, locale [, options])

where:

  • DatabaseName is a string expression representing the full path and name of the database file for the database being created. If you don’t supply a filename extension, ...

Get Access Database Design and Programming, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.