export access qry to another database with filepath from text box

gdesreu

Active Member
Joined
Jul 30, 2012
Messages
318
Hi guys,

I am trying to export an access query as a table in another database. The table name and query names are static but the filepath is dynamic. I would like to derive the filepath from a textbox on a form. So if you hardcode the path below where it says "TXTBOX FILEPATH" it works fine but if I try to insert the textbox value I get invalid qualifier compile error.


Code:
DoCmd.TransferDatabase acExport, "Microsoft Access", "TXTBOX FILEPATH", acTable, "Sdata", "sloc", False

Here is what I tried:
Code:
Private Sub Command59_Click()
Dim destination As String
destination = ([Forms]![frm_append]![Text57])
DoCmd.TransferDatabase acExport, "Microsoft Access", (destination), acTable, "GIS data locations - soil", "soilloc", False
End Sub

Any ideas as to what I obviously did wrong?
Thanks
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
Try removing the parenthesis, after all it is a variable, so, it should be fine.

Thanks Gina, I had tried that previously but it didn't work. I was having some odd Access behavior at the time. After rebooting and installing all of the MS updates, it works fine now without the parenthesis as you stated. Thanks!
 
Upvote 0
*Odd behavior* never good. If it's just that application suggest bringing all Objects into a clean database. If Access on the whole then the updates probably fixed it...
 
Upvote 0

Forum statistics

Threads
1,221,813
Messages
6,162,117
Members
451,743
Latest member
matt3388

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top