Import of txt files fails.

B

Bruce

I have a procedure that imports .txt files from a directory into my database.
The .txt files are , delimited.

I have found some of them are not importing (at all). These ones have a
square as the last character in the file (which i recall is the return key
character).

Is it possible to scan for and delete this character before doing the import?
What code should I use?

Bruce
 
T

TC

Take one of the files that does not work. Open it with Wordpad, or Word
- not Notepad - then save it to a new name as a plain text file. Try
the new file & see if that works. If so, post back here & I will tell
you what is going on.

HTH,
TC (MVP Access)
http://tc2.atspace.com
 
A

Alex Dybenko

Hi,
what you can do - is to open your text file in VBA using Open # statement,
then read file line-by-line, replace characters you need using Replace() and
then save it using Write #
Access help has several examples reading/writing text files

--
Best regards,
___________
Alex Dybenko (MVP)
http://alexdyb.blogspot.com
http://www.PointLtd.com
 
B

Bruce

Hi TC,

Sorry for delayed reply, Easter caught up with me however I am still keen to
resolve this one.

I have done what you said, opened the .txt file in Wordpad. It gives me the
options of saving as a Text document, Text document MSDOS format or Unicode
text. I have tried each of these and inspected the files contents. The
mysterious character is still there (as the last character in the file.

I have tried to import as a ‘Text document’ saved from Wordpad. The file
still does not import. In addition it does not create an error table that you
get when imports fail. Again if I manually delete/save this character import
works successfully.

What is the significance of this character?
Am I missing something here? What do you think should be happening?
What should I try next?

Bruce
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top