Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem importing text file 1

Status
Not open for further replies.

meldrape

Programmer
May 12, 2001
516
US
Greetings, I need to import a csv or text file either one and it keeps turning a text field into numeric when imported. There are only five fields. Here's an example of how I'm doing the import:
Code:
txtFile="c:/test.csv"
DoCmd.TransferText acImportDelim, , "tblEUImport", txtFile, True
There are five fields and I have the table design set so the fourth and fifth fields are text.
Code:
breakout,budget,orqty,itemno,description
The itemno field would be something like this: 020416RP but it's being translated as a number and strips off the leading zero and the RP. It doesn't matter whether it's a csv or txt file. I don't know how to fix this or force it to import as text into that field. Any thoughts would be greatly appreciated. Many thanks in advance.

 
Hi..

From the looks of your code ,you are not providing a specification file.

DoCmd.TransferText acImportDelim, "specfile" , "tblEUImport", txtFile, True
 
Many thanks, Lewds. How do I do that with VBA? I wanted to search this forum for my answers but the search functionality does not seem to be working today. Thanks again.
 
Hi again Lewds, I figured it out. I manually imported it and used the name of the spec file I created. Then plugged it in where you suggested and it's working now. Thanks again for your help!
 
HI...

Sorry for not getting back right away.

I'm glad it worked out for you.

Thank you for the star, if the SEARCH had been working, you would have found multiple solutions. This is the greatest forum around and has helped me with many of the problems that I've encountered.
 
Yeehaw to that! I turn to tek-tips whenever I get stuck or just to review to see if I can be of help to anybody else. The search functionality usually returns everything I need. Many thanks again for your answer.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top