Create new database on command from existing database

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a table in an existing database that I would like to export to a new
database using an event procedure or macro. I would like to name the new
database with the date it is created. Any suggestions?
 
You can create the database like this:
Dim ws As DAO.Workspace
Dim dbBackup As DAO.Database
Dim strFile As String
strFile = "C:\" & Format(Date, "yyyymmnn") & ".mdb"
Set dbBackup = ws.CreateDatabase(strFile, dbLangGeneral)

You can then execute an Append query statement to add the table to the
database. Create a query using the table you want to export. Change it to an
Append query (Append on Query menu). Access gives you a dialog where you can
specify the name of the external file to export to.
 
Thank you!
--
Dar


Allen Browne said:
You can create the database like this:
Dim ws As DAO.Workspace
Dim dbBackup As DAO.Database
Dim strFile As String
strFile = "C:\" & Format(Date, "yyyymmnn") & ".mdb"
Set dbBackup = ws.CreateDatabase(strFile, dbLangGeneral)

You can then execute an Append query statement to add the table to the
database. Create a query using the table you want to export. Change it to an
Append query (Append on Query menu). Access gives you a dialog where you can
specify the name of the external file to export to.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top