Export MS Access tables as dBase 5 through VBA MS_

2019-07-20 23:14发布

问题:

How can I export a single table as a dBase 5 file through VBA?

Currently I am using this VBA code:

DoCmd.TransferDatabase _
acExport, _
"dBase IV", _
"DB_Total", _
acTable, _
"DB_Total", _
"C:\Data", _
False

But when I try to execute this code, I get the following error (in dutch, so roughly translated):

"DB_Total is not a valid path"

But I'm not really sure what the path is, because the table I am trying to export is inside the Access file, right?

回答1:

You should need the full path to the output database in the 4th parameter:

 DoCmd.TransferDatabase acExport, "dBase IV", "c:\full\path\to\output", acTable, "TableNameInAccess", "DBFTable", False, False

Also I believe you will have to limit your output (DBFTable) to 8 or fewer characters because it is dBase IV.