Linking tables via an InputBox

kupe

Registered User.
Local time
Today, 11:21
Joined
Jan 16, 2003
Messages
462
Help, Masters

I want to link to tables with the User using an InputBox. I'm adapting it from a form I use to import Excel files. But Access doesn't like it like this. Can the mistake be seen, please?

Private Sub Command1_Click()


Dim strfilename As String

strfilename = InputBox("What is the name of the table you'd like to link to?")

'This below is one line
DoCmd.TransferDatabase acLink, "Microsoft Access", "tblNew", "T:\www.bemrosebooth.com\OnLine_Marketing\Link Building\Link Survey databases\" & "filename" & ".mdb", acTable, "tblFoison"


End Sub

Cheers
 
Kupe,
Try this:
Code:
DoCmd.TransferDatabase acLink, "Microsoft Access", "tblNew", "T:\[url]www.bemrosebooth.com\OnLine_Marketing\Link[/url] Building\Link Survey databases\" & strfilename & ".mdb", acTable, "tblFoison"
you referred to "filename" instead of strfilename
 
Cheers, Bert. I've looked at that a thousand times and didn't see it. Most grateful.
 

Users who are viewing this thread

Back
Top Bottom