TransferDatabase problems

RickR

Registered User.
Local time
Today, 20:23
Joined
Mar 13, 2002
Messages
14
Hello All,

I am trying to export a table from one database to another, to be used as an archive. I have tried to use the TransferDatabase method but keep coming up with an error:

runtime error '2006'
The object name 'C:\Program Files\Commission_Database\Backup\Backup.mdb"you entered does not follow Microsoft Access object-naming rules.


Here the code:
_______________________________________
Dim tblname As String
Dim dbSource As String
Dim dbDest As String

tblname = Format(Date - 90, "mmmyy")
dbSource = "C\Program Files\Commission_Database\ccauto.mdb"
dbDest = "C\Program Files\Commission_Database\Backup\Backup.mdb"

'DoCmd.SetWarnings False

DoCmd.OpenQuery "qryBackup"
DoCmd.Rename tblname, acTable, "Backup"

DoCmd.TransferDatabase acExport, "Microsoft Access", dbSource, acTable, tblname, dbDest

'DoCmd.SetWarnings True
_________________________________________

It doesn’t seem to like the .mdb extension, however if I take it off I get a copy of the table in my current database with the name of "C:\Program ...\Backup"

What am I doing wrong??

Thanks a lot,

Rick
 
I firgured it out, I had to play with source and destination (its quite confusing, at least to me). Here is the working code:

DoCmd.TransferDatabase acExport, "Microsoft Access", dbDest, acTable, tblname, tblname

Rick
 

Users who are viewing this thread

Back
Top Bottom