Weird Bug: docmd.TransferDatabase acLink error 3011

Royce

Access Developer
Local time
Yesterday, 18:56
Joined
Nov 8, 2012
Messages
99
Sometimes this line of code works, sometimes it gives me error 3011.
DoCmd.TransferDatabase acLink, "Microsoft Access", vPathname, acTable, vTableName, vTableName

When I step through the code in the debugger the values have always been valid, and when I step through it it always works.

But when it is called from Form_Open, or Form_Load on my startup form I get the error 3011. (sometimes it works, but I haven't figured out why.)

It comes from Peter Hibbs ubeUpdate backend updater, which runs in the front end. The error occurs with the CopyTable command. Several scenarios can occur, but typically I'm copying a table named "ubeMyTable" to the back end as "MyTable", dropping the old link to "MyTable" and trying to recreate a new link to the file that was just copied. ( I modified the original Peter Hibbs code some for debugging and to make it work in more scenarios, like when the backend table already exists.)

When I check the backend, MyTable is there. Sometimes the link actually get's recreated.

Any suggestions would be appreciated.
 
I had tried db.tabledefs.refresh. That did not work.

This seems to have fixed the problem.

' force a reload to avoid a quirky error.
db.Close
Set db = OpenDatabase(vPathname)
 

Users who are viewing this thread

Back
Top Bottom