How do I backup a table to another database with a macro or code?

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

Guest

I want to put a button on the main switchboard to copy a table from the
current database to a backup database in another location.

Also do I have to tweak Access to see a database on a server to backup to
it? It seems to have difficulty locating the file on the server.

Thanks!
 
This is the basic code to create the table in the mdb specified in strFile:

strTable = "Table1"
strFile = "\\Server1\MyPath\MyFile.mdb"
strSql = "SELECT * INTO [" & strTable & "] IN """ & strFile & _
""" FROM [" & strTable & "];"
dbEngine(0)(0).Execute strSql, dbFailOnError
 

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