PDA

Click to See Complete Forum and Search --> : Can you help me stop this run-time error?


brjames
May 1st, 2000, 10:42 PM
Having nearly finished a harbour booking system, I am currently tidying up the project and adding some error checking etc.

The problem is that I have a form with a data store and have previous and next buttons along with some text boxes to go through data from a database. When I use the previous and next buttons to go through the data they work fine until I go further than the last or first record. Then I get a run time eror that says that there is no current record.

How can I code some error checking that tells the person that there is no more records if they press the buttons to go further than the last record instead of having a run-time error?

Thanks in advance!

Glenn
May 1st, 2000, 10:50 PM
Before you perform the move method you need to check for eof or bof.



' Movenext

if rs.eof then
msgbox "End of records"
else
rs.movenext
endif

' Move previous

if rs.bof then
msgbox "Beginning of records"
else
rs.moveprevious
endif