Using TransferText to Import a File Specified in a Textbox

whdyck

Registered User.
Local time
Today, 09:00
Joined
Aug 8, 2011
Messages
169
I'm using MS Access 2003.

I'm have a form on which the user clicks a Browse button to select a file to be imported into Access. If I use the following syntax to do the import, I receive a run-time error "Type mismatch":
Code:
DoCmd.TransferText acImportDelim, "LiaImportSpecification", "tblLiaSourceImport", Me.txtLiaImportFile.Text, False
(The textbox stores the path and filename that was browsed.)

However, if I change the code by substituting a string literal for the textbox reference, it works:
Code:
DoCmd.TransferText acImportDelim, "LiaImportSpecification", "tblLiaSourceImport", "H:\SmartSoft\SsLogistics\CSVInput\lia.csv", False
Note: The file referenced in the string literal above is the same path/filename selected and stored in the textbox in the first code snippet above.

Any idea what I'm doing wrong?

Thanks for any help you can give.

Wayne
 
The .Text property requires focus, though I'd expect a different error. Try the .Value property instead.
 
The .Text property requires focus, though I'd expect a different error. Try the .Value property instead.

That resolved it! Thanks very much.

Wayne
 

Users who are viewing this thread

Back
Top Bottom