DoCmd.TransferText from TextBox Form

joe789

Registered User.
Local time
Today, 22:02
Joined
Mar 22, 2001
Messages
154
Hi Folks,

I am not sure what I am doing wrong here. I have this code that works perfectly to import a file:

Private Sub Command0_Click()
DoCmd.TransferText acImportDelim, "270 Import Specification", "Temp", "C:\test270.txt"
End Sub


As soon as I try to add a few lines of codes pasted below to attempt to grab the name of the file to be imported from a textbox on the form the command button is on to launch the code, it bombs:

Private Sub Command0_Click()
Dim FileImportName As String
FileImportName = Text1
DoCmd.TransferText acImportDelim, "270 Import Specification", "Temp", ('"& FileImportName &"')
End Sub

Any help would be greatly appreciated. I have tried so many different things at this point to get it to work, that I figure I must be missing something completely.

Thanks,

Joe
 
Private Sub Command0_Click()
DoCmd.TransferText acImportDelim, "270 Import Specification", "Temp", Me.Text1
End Sub

FYI, You will find your code much easier to read when you go back to it in the future if you have given your controls meaningful names.
 

Users who are viewing this thread

Back
Top Bottom