Can anyone help with this code please (1 Viewer)

dxp

Registered User.
Local time
, 17:43
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
 

boblarson

Smeghead
Local time
, 17:43
Joined
Jan 12, 2001
Messages
32,059
Get rid of the quotes around tmpFilePath in your TransferDatabase code.
 

RuralGuy

AWF VIP
Local time
, 18:43
Joined
Jul 2, 2005
Messages
13,825
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.
 

Jacob Mathai

Registered User.
Local time
Today, 01:43
Joined
Sep 6, 2001
Messages
546
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"
 

dxp

Registered User.
Local time
, 17:43
Joined
Jun 5, 2006
Messages
62
Thanks boys, removed "" and repositioned tmpFilePath works like a dream. My regards and thanks.
 

Users who are viewing this thread

Top Bottom