473,322 Members | 1,501 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

importing text in vba with a variable picked up from a table

Can someone see why this does not work? I am trying to get some text from a
tab delimited text file called staff.txt into a table called tblStaff, The
actual path to the text file will vary, so I am trying to do a simple
DLookup in a table that gives the path part then, concatenate that with the
filename.
I have this, but I am getting an error "An expression you entered is the
wrong datatype for one of the arguments".

DoCmd.TransferText , acImportDelim, "Staff Import specification",
"tblStaff", DLookup("[LetterLabel]", "tblButtons", "ID=150") & "Staff.txt"
Jan 31 '07 #1
1 1367
On Wed, 31 Jan 2007 18:47:02 +1100, "Dixie" <di***@dogmail.comwrote:

I'm guessing LetterLabel does not have a trailing backslash. In that
case you need to write:
....DLookup("[LetterLabel]", "tblButtons", "ID=150") & "\Staff.txt"

You can debug this by executing the DLookup statement by itself in the
Immediate window:
?DLookup(...)

-Tom.
>Can someone see why this does not work? I am trying to get some text from a
tab delimited text file called staff.txt into a table called tblStaff, The
actual path to the text file will vary, so I am trying to do a simple
DLookup in a table that gives the path part then, concatenate that with the
filename.
I have this, but I am getting an error "An expression you entered is the
wrong datatype for one of the arguments".

DoCmd.TransferText , acImportDelim, "Staff Import specification",
"tblStaff", DLookup("[LetterLabel]", "tblButtons", "ID=150") & "Staff.txt"
Jan 31 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Glen | last post by:
I presently use the following code to import an Excel Spreadsheet: DoCmd.TransferSpreadsheet acImport, SpreadsheetType:=8, _ TableName:="tblImportPlayerInformation", _...
1
by: sparks | last post by:
I have never done this and wanted to ask people who have what is the best way. One person said import it to excel, then import it into access table. but since this will be done a lot, I am...
6
by: Sam Lazarus | last post by:
I need to import data from a website, but the text is arranged badly: Name:John Doe Title:Grunt ID:314159 Name:Jane Doe Title:Queen-Bee ID:271828 etc...
7
by: Darren | last post by:
I have been attempting to create a reservation planning form in excel that imports Data from an Access database and inserts that information automaticly into the correct spreed sheet and the...
2
by: kuhni | last post by:
Hi everybody, I am totally desperate because I cannot solve a really simple problem: I have a specific text-file which I want to import into an existing database. The problem is that the columns...
9
by: jillandgordon | last post by:
I am trying to import an excel file into Access 97. It looks perfectly all right but, every time I try to import it, I get to the lst step and am told that it was not imported due to an error. ...
14
by: MLH | last post by:
GHudson has working procedures posted at http://www.access-programmers.co.uk/forums/showthread.php?t=66320 They work. Relationships, however, and some minor default settings are not preserved....
5
by: hharriel | last post by:
Hi, I am hoping someone can help me with an issue I am having with excel and ms access. I have collected data (which are in individual excel files) from 49 different school districts. All...
2
by: Debbiedo | last post by:
I have a text file that I am importing into an Access table that was generatred from data exported from a Word file. Several (about 20-30) fields are from check boxes on the Word form. These fields...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.