I found this code (thanks to this forum) and it works great!
Sub CreateNewDB()
Dim wsp As Workspace
Dim dbs As Database
Dim strDBFile As String
strDBFile = "C:\NewDB.mdb"
Set wsp = DBEngine.Workspaces(0)
Set dbs = wsp.CreateDatabase(strDBFile, dbLangGeneral)
DoCmd.CopyObject strDBFile, , acTable, "Table1"
dbs.close
Set dbs = Nothing
Set wsp = Nothing
End Sub
I have a button on my form (Send), that runs a make table query, then runs this code. I would like for it to name the new database with the customer job number. Something like this C:\(Me.MyFormField).mdb. But I'm not sure how to write this part.
Thanks gMAC
Sub CreateNewDB()
Dim wsp As Workspace
Dim dbs As Database
Dim strDBFile As String
strDBFile = "C:\NewDB.mdb"
Set wsp = DBEngine.Workspaces(0)
Set dbs = wsp.CreateDatabase(strDBFile, dbLangGeneral)
DoCmd.CopyObject strDBFile, , acTable, "Table1"
dbs.close
Set dbs = Nothing
Set wsp = Nothing
End Sub
I have a button on my form (Send), that runs a make table query, then runs this code. I would like for it to name the new database with the customer job number. Something like this C:\(Me.MyFormField).mdb. But I'm not sure how to write this part.
Thanks gMAC