SteveL13
asked on
Trying to export a table to another Access database file
I'm trying to export a table to an external Access database file via VBA code. The code I'm trying is:
DoCmd.TransferDatabase acExport, "Microsoft Access", LFilename, acTable, "qryHeaderRecordsToArchive ", "tblDataHeader- & Me.txtFileNameAndLocation, False"
But it isn't working. Note LFilename is establish with:
LFilename = DLookup("[ArchiveFileLoc]" , "tblSetup") & "\" & Me.txtFileNameAndLocation & ".accdb"
So I'm hoping to get the exported file table to be named tblDataHeader PLUS Me.txtFileName
In other words tblDataHeader-something (something being the Me.txtFileNameAndLocation part of it.
DoCmd.TransferDatabase acExport, "Microsoft Access", LFilename, acTable, "qryHeaderRecordsToArchive
But it isn't working. Note LFilename is establish with:
LFilename = DLookup("[ArchiveFileLoc]"
So I'm hoping to get the exported file table to be named tblDataHeader PLUS Me.txtFileName
In other words tblDataHeader-something (something being the Me.txtFileNameAndLocation part of it.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
DoCmd.TransferDatabase acExport, "Microsoft Access", LFilename, acQuery, "qryHeaderRecordsToArchive
But you were correct. I needed to change acTable to acQuery