I’m a new VBA programmer trying to append everything from a TableA in Database1 to a TableA in Database2. I wrote a DoCmd.TransferDatabase statement called in an access macro. The statement executes without any error, but it does not transfer the data.
–>RUNS IN Database1…
DoCmd.TransferDatabase acExport, "Microsoft Access", "I:\Database2.mdb", acTable,
"TableA", "TableA", True
I don’t really know how to debug this, because the statement is executing without an error from the compiler and there is no way to “see” what happens once it fires.
-The path/table names are correct because if they are wrong, the compiler throws an error (learned the hard way…!)
What should I do to debug?
You used True for the StructureOnly parameter. From Access’ online help topic for TransferDatabase:
Use True (–1) to import or export only the structure of a database table. Use False (0) to import or export the structure of the table and its data. If you leave this argument blank, the default (False) is assumed.
So the moral of that story is use False if you want to transfer TableA and any data it contains. Use True if you want to transfer only the table structure without any data it contains.