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!

PROBLEMS IMPORTING A FILE WITH CODE

Status
Not open for further replies.

kaniz

Technical User
Jan 17, 2001
38
CA
I have text file that imported into access using the

DoCmd.TransferText acImportDelim, "LABOR IMPORT SPECIFICATION", "LABOR", "O:\LABOR.TXT", 0


This textfile is created using a software called scan books, so all the forms are scanned and the information goes into this text file. The problem I am encounter is that sometimes the forms don't scan properly on the file so instead it adds a line of garbage. When I imported to access all this garbage gets also imported. I was wondering if there is way of importing this file but one field at the time using code so that I can check it. Otherwise I will have to edit the the text file manually. Any suggestions will be greatly appreciated.

PS. I would like to thank all of you who have helped in the past. I did not know where else to thank everyone. This is a great forum.




 
You can, of course, read in the test file in a number of ways depending on the 'structure'. From your (programming) statement, the file is delimited (by commas), so you could easily just open the file and "Line Input" a records worth of text and parse it for the commas or some signature(s) denoting either [Good | Bad] stuff.

On the other hand, using TransferText as you are doing will get the info from the file into a "table" much faster.

Once it is in a table, the same [GoodGuy | BadGuy] criteria could be used to identify (and "correct") the problems. In general, I get 'information' into Ms. Access by placing it in a 'temp' table. From there, a number of validity checks are done to identify (and exclude) records which do not belong in the database. I normally copy (move) these to another 'temp' table - for return to the information originator for correction / replacement / feedback. the remaining records are then added to the 'real' table and the temp table is deleted.


MichaelRed
redmsp@erols.com

There is never time to do it right but there is always time to do it over
 
Hi Michael thank you for your reply I am not quite sure what do you meant "Line Input" a records worth of text and parse it for the commas or some signature(s) denoting either [Good | Bad] stuff. Is line input an access command
 
Yes.

Use with "Open "FilePath&Name", for Input as #FileNumber

Read the help for "Open Method".


MichaelRed
redmsp@erols.com

There is never time to do it right but there is always time to do it over
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top