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

Multiple Data Sets

Status
Not open for further replies.

mtownbound

Technical User
Jan 28, 2002
293
US
I have one text file that has 3 sets of data that I need to import into Access. Basically, it has the header, the body, and the trailer. Each section has data mappings, but the problem is configuring Access to pull the first 20 characters and use that as the "date" for each row of data in the body? Same for the trailer. Let me see if I can illustrate:

20101025Project3455 (This is the header)
John Doe 19650518 321 Elm Street (Two rows in the body)
Jane Doe 19810112 314 Maplewood Drive
20101025Project3455 (This is the trailer)


Any ideas??

Thanks!!!!!
 
I have two options, neither of which is all that simple...

You can open the text file and read it line by line. Within this option you have two suboptions, either break the file out into multiple text files and import those or use recordsets and import the data line by line.

The Other way to go would be to import the whole file into a table with one long field. Then loop through all the records using a recordset and process one by one.

The handful of times I have seen files like this, there is typically a key that identifies the recordtype... Like 1 is the header and 2 is the detail or whatever makes sense in the file...

I hope this is what you needed.
 
Thanks for the reply. Your first suggestion is pretty much what I've been doing so far....just opening the file and manually removing the header and trailer and importing just the body.

Guess I'll keep testing until I come up with a solution.

Thanks again for the response!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top