Hi
I am trying to figure out how to create a MS Access database from a file (with code not from within access).This file has many lines in it. Can anyone help me to get started? Each line will have 3 to 4 fields in it. Any help would be appreciated.
Printable View
Hi
I am trying to figure out how to create a MS Access database from a file (with code not from within access).This file has many lines in it. Can anyone help me to get started? Each line will have 3 to 4 fields in it. Any help would be appreciated.
Hi heres the code that I am using to dynamically create a database, I can't claim any credit as it was an example on this site.
Don't forget get to reference the DAO object.
Hope it helps
Geoff ;)
Dim wrkDefault As Workspace
Dim newConfig As Database
Dim SQLstr As String
On Error GoTo ERRdataBase
Set wrkDefault = DBEngine.Workspaces(0)
Set newConfig = wrkDefault.CreateDatabase(DEFAULTcfg, dbLangGeneral)
With newConfig
'create a tabled called TableY with two feilds
SQLstr = "CREATE TABLE TableY (FirstName TEXT, LastName TEXT);"
.Execute SQLstr
.Close
End With
Exit Sub
ERRdataBase:
MsgBox Err.Description & " " & Err.Number