Here is the list of tables as printed to the Immediate window by the NewTableprocedure:
MSysAccessStorage
MSysACEs
MSysComplexColumns
MSysNavPaneGroupCategories
MSysNavPaneGroups
MSysNavPaneGroupToObjects
MSysNavPaneObjectIDs
MSysObjects
MSysQueries
MSysRelationships
Order Details
Orders
Products
Shippers
Suppliers
tblNew
If you open tblNew in datasheet view, you will see a zero in the ShiftSupervisor Boolean
field. If you prefer to see True/False or Yes/No values, you will have to select the format
of your choice manually; the CreateFieldmethod does not have an argument for setting the dis-
play format for a field.
NOTENOTE
Working with Access Data 5
Other Ways of Creating Tables Programmatically
I
n addition to the CreateTableDefmethod, there are three other ways to create Access tables in
VBA code:
nThe CopyObjectmethod of the DoCmd object in the Access object model creates a new
table based on an existing table.
nExecuting a make-table query using the OpenQueryor RunSQLmethod of the DoCmd
object, or the Executemethod of QueryDef object, creates a new table as the output of
the query.
nA Jet SQL CREATE TABLE statement, as in the following code, can be used to create a
table:
strSQL = “CREATE TABLE “ & “tblForms” & _
“(FormName TEXT (100), Use YESNO);”
DoCmd.RunSQL strSQL
Compared with these techniques, the CreateTableDefmethod gives you the maximum control
over the new table’s fields and their properties. However you create a table, it will be appended to
the TableDefs collection, and it will show up in the Tables group of the database window.