TransferDatabase method works sometimes, but not other times

C

Candy B

DoCmd.TransferDatabase acExport, "Microsoft Access", _
fileName, objType, ObjName, ObjName, True

fileName, objType,and objName are variables

The above code works sometimes. However, sometimes I would
get an error message "The transferdatabase action was
canceled." When this happens, I can't save my file
because it says "You do not have exclusive access to the
database at this time...."

What is wrong here?

Thanks.
 
Top