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 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