Can anyone help with this code please

dxp

Registered User.
Local time
Today, 16:05
Joined
Jun 5, 2006
Messages
62
Can anyone help with this code please. I keep getting Error 13, type mismatch on the on click event of a Command button.

Private Sub Command6_Click ()
Dim tmpFilePath AS String
tmpFilePath = Me!Text1

DoCmd.DeleteObject acTable, "Expire"
DoCmd. TransferDatabase_ acImport,"MicrosoftAccess",acTable,"tmpFilePath","Expire","Expire",False

End Sub

What I am trying to do is delete a table and replace it with a table of the same name in another db. the path to the file is stored in Text1. The delete part works OK then the error message arrives, when I run it with a static file path it worked ok, but I want to pick up the path stored in Text1 on my form.:confused:

Thanks for your help
 
Get rid of the quotes around tmpFilePath in your TransferDatabase code.
 
You need to review the VBA help on TransferDatabase I see spaces and underscores in your code that do not belong and your arguments are not in the correct order and tmpFilePath probably does not need quotes surrounding it.
 
Use the help key to find Transferdatabase syntax.

Example :

DoCmd.TransferDatabase acImport, "Microsoft Access", _
"C:\My Documents\NWSales.mdb", acReport, "NW Sales for April", _
"Corporate Sales for April"
 
Thanks boys, removed "" and repositioned tmpFilePath works like a dream. My regards and thanks.
 

Users who are viewing this thread

Back
Top Bottom