Results 1 to 2 of 2

Thread: Can you help me stop this run-time error?

  1. #1

    Thread Starter
    Lively Member brjames's Avatar
    Join Date
    Jan 2000
    Location
    Tenby, Wales, UK
    Posts
    121
    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!

  2. #2
    Addicted Member
    Join Date
    Jan 2000
    Location
    Oshkosh, WI
    Posts
    163

    Thumbs up

    Before you perform the move method you need to check for eof or bof.

    Code:
    ' 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
    Glenn D
    Development/Analyst

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width