Duplicating Tables in VBA

R

redrover

I need to create a backup of 2 tables before I perform a yearly maintenance
on this database. In the current world, new tables are manually created,
forms are changes, etc. I've automated everything except the copying of the
tables. I've tried using the following code to create the copy of the first
table but I get a message that my file cannot be found. What am I doing
incorrectly?

Dim strYear As String
Dim strDB As String
Dim cnn As ADODB.Connection
Set cnn = CurrentProject.Connection

strYear = Year(Date) - 1
strDB = strYear & "TeamMemberSummary"

DoCmd.TransferDatabase acImport, "Microsoft Access", "[071205 2007 Team
Member Summary.mdb]", acTable, "[tblTeamMemberSummary]", strDB

strDB is the name of the new table. I've tried multiple methods to identify
'071205 2007 Team Member Summary.mdb' but I get the same error message each
time.
 
D

Dennis

Is the database in a different directory? If so, and if you don't provide the
path, it won't find it (of course).
 
L

Lance

You might want to include the directory path to it. And are you really
meaning to import from it, instead of exporting to it?
 

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

Top