Question : DoCmd.TransferDatabase problems

Greetings,
I am creating a form that will run with the runtime version of ACCESS 2007.  I have tables that need to synchronize with a PDA so the files have to have the .mdb extension instead of the runtime extension.

I have a button that I want to copy all of the tables from the current database (WF87RX) to an intermediate file with the mdb extension (WF87PDALink).
Here is the code I tried:
Private Sub cmdExportMDB_Click()
DoCmd.TransferDatabase acExport, "Microsoft Access", "C:\WetForm\WF87PDALink.mdb", acTable, "WetForm", "WetForm", False
End Sub

I got the error:
You can't delete the table 'WetForm', it is participating in one or more relationships.

I definitely don't want to delete the table anywhere.
Should I be using a different command?
Here is the pseudocode

If c:\WetForm\WF87PDALink.mdb doesn't exist   THEN
create c:\WetForm\WF87PDALink.mdb with all of the tables in the current database
ELSE
Copy all of the tables in the current database to c:\WetForm\WF87PDALink.mdb
End IF

I will make another button that does the reverse.

If c:\WetForm\WF87PDALink.mdb doesn't exist   THEN
Error message
ELSE
Warning message that tables will be overwritten - with OK
Copy all of the tables from c:\WetForm\WF87PDALink.mdb into the current database
End IF

I have been fishing for the right commands to do this but haven't fount the right one yet.

Thanks,
Pat

Answer : DoCmd.TransferDatabase problems


create the db first

Sub createDBDAO()
Dim db As DAO.Database
Set db = CreateDatabase("C:\myZZZ.mdb", dbLangGeneral, dbVersion40)
db.Close
Set db = Nothing
End Sub
Random Solutions  
 
programming4us programming4us