Article ID: 141886
Article Last Modified on 1/19/2007
Public Function CreateDB()
Dim newdb As DATABASE, mydb As DATABASE
Dim dbname As String
Dim tdf As TableDef
'Set the path and name for the new database.
dbname = "c:\msoffice\access\Newdb.mdb"
'Create the new 2.0 database and close newdb.
Set newdb = DBEngine.Workspaces(0).CreateDatabase(dbname, _
dbLangGeneral, dbVersion20)
newdb.Close
'Export all non-system tables to the version 2.0 database.
Set mydb = CurrentDb()
For Each tdf In mydb.TableDefs
If (tdf.Attributes And dbSystemObject) = 0 Then
DoCmd.TransferDatabase acExport, "Microsoft Access", _
dbname, acTable, tdf.Name, tdf.Name
End If
Next tdf
End Function? CreateDB()
Keywords: kbhowto kbprogramming KB141886