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!

Reading text file and convert it to database table

Status
Not open for further replies.

germanrc

Programmer
Mar 9, 1999
7
0
0
US
In order to update a data base in access format I need to convert a text file in a VB application. How...
If some body have any solution please let me know
germanrc@tld.net
 
One way would be to read the text file line-by-line using the Line Input #(delimited text files) or Input# (looking for EOF). As you receive each line in the text file, write that text, using AddNew, to a new record in a temporary Access database table that you have previously created. That temporary table should contain just one field. Then, when you have finished reading the entire text file (reached EOF), go thru that temporary database table, retrieve each record, parse the line (using MID$) storing the text values in variables that will be placed in your target table.
You might could also skip the temporary table part, parse the text string being read from the text file, and place that data directly into your target table. I haven't tried this last approach, but I have used the first approach many times. Good luck!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top