Results 1 to 4 of 4
  1. #1
    Join Date
    Jan 2010
    Posts
    44

    Unanswered: Record Set Navigation

    I made a record set and I made my own rs.movenext and rs.moveprevious. How can I check to verify if they are on the first record in the record set that they are not able to use moveprevious and the same thing if they are on the final record, not able to movenext?

    Thanks.

  2. #2
    Join Date
    Mar 2010
    Posts
    15
    Well..since you are wanting to do things programmatically

    One solution is if you could add a UniqueID to your recordset that is an incremental value. Each time a record is added it would increment, thus giving you a way to keep track of the total number of records.

    That way for the moveprevious: If recordID = 1 then msgbox ("You are at the beginning of recordset", vbInformation, "Info")

    For movenext: If recordID = Count(recordID) then msgbox ("Your are at the end of the recordset", vbinformation, "Info")

    Just one way of doing it I suppose if you can add a uniqueID to your RS.

  3. #3
    Join Date
    Jan 2010
    Posts
    44
    Thanks for your help.

  4. #4
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926
    You can also turn on/off the navigationbuttons on the form.

    Ex:
    Forms!MyFormName.NavigationButtons = false

    Another method is to create buttons on the form for navigation.

    ex:
    Private Sub cmdMovePrev_Click()
    On error goto DonePrev
    docmd.gotorecord,,acprevious
    exit sub
    DonePrev:
    msgbox "You are at the first record."
    end sub

    Private Sub cmdMoveNext_Click()
    On error goto DoneNext
    docmd.gotorecord,,acnext
    exit sub
    DoneNext:
    msgbox "You are at the end of the recordset."
    end sub
    Last edited by pkstormy; 04-07-10 at 23:23.
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

Posting Permissions

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