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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

need help importing .txt files into Access

Status
Not open for further replies.

bdog2g

Technical User
Feb 18, 2002
12
US

I'm using Access 2000

I would like to import a comma-delimited .txt file generated by another program into an Access Table with the first line of the file being the field name. I would like to do this with VBA code. My problem is I don't need all 40 columns in the text file. I've used the Import wizard but it doesn't give me what I want. The imported text file is to be stored in a temporary table for data manipulation purposes and then exported to several excel templates.

If anyone has suggestions, they would be welcomed

 
What does it do wrong? If you are going to import it to a temp table and then run other queries/code against it, it shouldn't matter if it imports all of the fields or just those that you need. Please explain it a little better and I am sure someone will be able to help. Terry M. Hoey
 
In Access 97

The Import wizard (When Used from the File > Get External Data > Import Menu) brings upa dialog bos whic allows the selection of csv files. Following the steps of the Wizard you select Delimited on the first screen, Commma and First Row Contains field Names on the second, the table name on the third. The fourth screen allows you to select which fields to Import, bur also you can click the Advanced button which will list the fields which you can format the data types (overcoming the problem of numbers being selected as text and vice versa). Return from advanced. You follow the next few steps until you get to the Finish screen. Before Clicking Finish Click advanced again and the Click Save As this will allow you to save a specification for importing these files time and again.

In code the command DoCmd.TransferText allows you to use this specification.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top