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

Import new fields from text file to Access 2

Status
Not open for further replies.

Mellowned

MIS
May 9, 2006
2
US
Hi everyone! I have 2 questions but I want to first discuss my problem. I figured out how to import a text file to access automatically using a button created on a form. This code is posted below and works great! However, after importing, I manually change 1 field into about 6 fields. This is because my notes field in the text file has too much data in it so I transfer that data into several newly created fields in the database. An example is notes to workaround, notes to data created, and so on. Also, when I import my text file daily, it also imports data I already have in the table. So my 2 questions are:
1) How do I change my code to import only NEW data instead of all data?(I cannot delete the old table due to the manual work I put in with changing the other fields)
2) Since I have added new fields to the database, when I now import the new text file I receive an error message saying field 'F7' does not exist within the database. I know it does not exist but I would like to create blank fields on the import and manually change the data later. I hope my questions are clear! If not let me know and thanks for any help in advance! I really love this web site! Code is posted below.


DoCmd.TransferText acImportDelim, "", "TblCustomer", "C:\Customer.txt", False
 
A common way is to import the text file into a temporary table and then use an Append query.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Import to some temporary table and then run an INSERT INTO query to add specific records (for example only those after some date field in the record) to the permanent table. You can also use the INSERT INTO (this is not guaranteed) to split the text field into the various new fields that you have created.

[small]No! No! You're not thinking ... you're only being logical.
- Neils Bohr[/small]
 
Sorry PHV ... you type faster than I do.

[small]No! No! You're not thinking ... you're only being logical.
- Neils Bohr[/small]
 
Thanks for the replies, I'm attempting to figure the append query out right now
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top