Click to See Complete Forum and Search --> : How to create a msaccess database?
paul
Oct 9th, 1999, 11:52 AM
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.
Geoff Gunson
Oct 10th, 1999, 09:35 PM
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
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.