executing through eof

mikeo1313

Registered User.
Local time
Today, 08:06
Joined
May 27, 2010
Messages
50
I built an app that compares the next record with the current. The way I did it was storing current values into variables then .movenext and compare. then moving back before progressing through the rest of the code that takes into consideration whether certain data between the current and the record that follow match.

What I wasn't expecting as its my first time ever doing any vba is that if I reach eof inside my loop it won't continue if it runs into a place where it has to evaluate.

Is there a way to turn off the warning/break in the code via setting a flag of sorts.

I coded a workaround as per my code logic but I'm just curious if theres a flag that will stop the error. thanks
 
Since we can't see what you currently have, it is extremely important for you to provide us with the code you are using.
 
normally you would include some sort of test for end of file, and use that to decide you can now exit

at its simplest

do
...
...
rst.movenext
if rst.eof then goto done
loop


done:
...
...
 
I ended up rewritting EVERYTHING, :( I was previously tring to fix something that was overly complicated :eek: to nail so I didn't want to rewrite, I just wanted the code to execute as the logic didn't have a problem.

My problem was that within a do while not rs.eof, I moved around the recordset forward and back,,, as it was my first vba program,, I didn't think the program would crash if you tried to assign any values @ eof.

Lesson learned
 

Users who are viewing this thread

Back
Top Bottom