Wrox Programmer Forums
|
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 5th, 2005, 02:51 PM
Friend of Wrox
 
Join Date: Oct 2004
Posts: 564
Thanks: 0
Thanked 4 Times in 4 Posts
Default EOF as part of last Line

Has anyone ever seen a csv file where the EOF character is included in the last record? I have this problem where is give and EOF error when the attempt is made to read the last record. Anyone have any ideas around it, aside from inserting a blank dummy record at end before I read each line in?

Thanks

Mike

Mike
EchoVue.com
__________________
Mike
EchoVue.com
 
Old December 5th, 2005, 04:06 PM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

Do Until rs.EOF = True


Loop

That should work.

I have seen that character inserted in all types of files. It carries into Excel as an unrecognized character, and if you transfer the spreadsheet, it even comes in as a blank record, except for the first field.

If you put a condition on the logic to account for this, then it should work.

HTH



mmcdonal
 
Old December 5th, 2005, 04:26 PM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

Actually, if you are parsing a csv file, then you are looking for the EndOfStream, so I am not sure why this is causing a problem.

I would use a text reading function, and possibly delete the last line in each file???

I usually read the text files, rather than use EOF, I use AtEndOfStream, and don't have this problem.

More facts, more solutions. Sorry for the malformed reply.

mmcdonal
 
Old December 5th, 2005, 08:57 PM
Friend of Wrox
 
Join Date: Oct 2004
Posts: 564
Thanks: 0
Thanked 4 Times in 4 Posts
Default

Doh! Sorry, I only found out about TextStreams a month ago, on an unrelated project, and I guess didn't implement them properly in this one - This would explain some of the EOF errors as well

Please forgive my ignorance!

Thanks

Mike

Mike
EchoVue.com
 
Old December 7th, 2005, 08:49 AM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

If you are using text streams, they will see that end of record character as a record, but it won't have the proper fields, of course.

mmcdonal





Similar Threads
Thread Thread Starter Forum Replies Last Post
EOF stealthdevil Access VBA 2 December 21st, 2006 12:41 PM
HELP WITH EOF chiraagb Classic ASP Databases 12 May 6th, 2004 04:51 AM
While not EOF goplayoutside VB.NET 2002/2003 Basics 3 April 22nd, 2004 04:14 PM
EOF in ODBC spraveens PHP Databases 3 March 29th, 2004 12:17 AM
eof new BOOK: Beginning Visual C++ 6 0 October 9th, 2003 07:33 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.