Moving to previous row

V

vm

I am connecting to an access db via vb6. I have put the standard 4 buttons
for First Record, Previous Record, Next Record, & Last Record. The buttons
for First & Last record work well, they are justrs.movefirst & rs.movelast.
The problem is with the previous & next buttons whenit comes to the first &
last record respectively.

My code for the previous button is:
if rs.BOF = true then
rs.movefirst
else
rs.movePrevious
displayIt '{DisplayIt is a sub to fill values into text fields}
end if

The problem is that rs.BOF is never true. Even when I move to the first
record, the rs.BOF is false. The same is true of the next button using the
rs.EOF check. It is always false. Of course since it is false it tries to
display the previous {and next} record - it errors out with "No current
record"

This seems simple enough, but why won't the BOF & EOF flag true if it is at
the beginning or end of file. All other aspects of the code with the db is
working perfectly, new, delete, search, update.

Any ideas?

vm
 
V

Van T. Dinh

There are a number of different methods. In Access, we can use the Form's
CurrentRecord which I don't think available in VB6.

BTW, you should post your solution so that others who have similar problems
can see your solution ...
 

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