PDA

View Full Version : Select text from txt file and import into access



EricM
02-08-2007, 05:49 AM
I have a text file I need to extract data from and then append to a access database. The file is continuously updated so I need to add only new data and ignore any old data. The key to new data is a date stamp in the text file. [ ASD yyyy mm dd hh:mm]
Once I find the new data I need to extract only line with data which has 15 tab seperated fileds. (I will use just 4 or 5 in my example)

ASD 2007 01 02 13:21
who what where when why
23 *** **** **** ****
34 23 18 12 34
36 *** **** *** *****
24 *** **** **** *****
18 12 54 11 56

What I need to extract is the lines that do not have ****. So in this example it would be

ASD 2007 01 02 13:21
34 23 18 12 34
18 12 54 11 56

The Next time the file would look like
ASD 2007 01 02 13:21
who what where when why
23 *** **** **** ****
34 23 18 12 34
36 *** **** *** *****
24 *** **** **** *****
18 12 54 11 56

ASD 2007 01 02 14:21
who what where when why
23 *** **** **** ****
34 21 10 12 11
36 *** **** *** *****
24 *** **** **** *****
18 12 54 11 56

So this time I only need to append to the table:
ASD 2007 01 02 13:21
34 21 10 12 11
18 12 54 11 56

The date would be primary key? so I can easily search the database and run reports based on date/time or ASD # plus date/time. The ASD can be dropped so only the numeric values of the date/time are posted to the db.

Oorang
02-08-2007, 07:00 AM
Were it me, I would import the table. Then do an append query, filtering on the date field. If you only wanted items added on or after today for example you might do >= Date(). You might also do >=[Please Enter Date] to prompt the user.