Results 1 to 8 of 8
  1. #1
    Join Date
    Jan 2004
    Location
    Texas
    Posts
    37

    Unanswered: Prev/Next Buttons

    I have a form that I want to fill based on certain (field) criteria.

    Using the Form_Open() sub I can open and loop thru my recordset
    to find the 1st qualified event ... no problem ... how do I maintain visibility to that Form_Open() sub recordset for my "next" "prev" etc... buttons?
    A2K - W2k
    Thanks & Regards
    Pete

  2. #2
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713

    Re: Prev/Next Buttons

    Originally posted by pltx2000
    I have a form that I want to fill based on certain (field) criteria.

    Using the Form_Open() sub I can open and loop thru my recordset
    to find the 1st qualified event ... no problem ... how do I maintain visibility to that Form_Open() sub recordset for my "next" "prev" etc... buttons?
    That depends on if the recordset is local to the Form_Open method or not ... You can call any method of a form after the initialization is done ...
    Last edited by M Owen; 01-24-04 at 18:53.

  3. #3
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1
    Use DoCmd.GoToRecord , , acPrevious ,
    DoCmd.GoToRecord , , acNext

  4. #4
    Join Date
    Dec 2003
    Location
    The Netherlands
    Posts
    98

    Lightbulb Error message prev/next button

    Hi,

    When I use the prev/next button and I go to the end of the recordset and THEN click on the button again I get an error message saying smoething like 'you can't go on.. blablabla' and then I get ANOTHER error message explaing why this message is generated. I don't want the second message. WHAT CAN I DO?

  5. #5
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1

    Re: Error message prev/next button

    Originally posted by charlottevk
    Hi,

    When I use the prev/next button and I go to the end of the recordset and THEN click on the button again I get an error message saying smoething like 'you can't go on.. blablabla' and then I get ANOTHER error message explaing why this message is generated. I don't want the second message. WHAT CAN I DO?
    You have to check whether EOF or not yet . If tru then go to the first record else moveNext

  6. #6
    Join Date
    Dec 2003
    Location
    The Netherlands
    Posts
    98

    Re: Error message prev/next button

    Originally posted by hammbakka
    You have to check whether EOF or not yet . If tru then go to the first record else moveNext
    I'm sorry but I don't understand what you mean precisely. Would you mind explaining?

  7. #7
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1
    If you have button called goNext (for the next record), and another one called goPrev (for the previous Record), then try this code


    Private Sub cmd_goNext_Click()
       Dim rst As Recordset
       Set rst = Me.RecordsetClone

    &nbsp;&nbsp;&nbsp; If Me.CurrentRecord <= rst.RecordCount - 1 Then
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DoCmd.GoToRecord , , acNext
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cmd_goPrev.Enabled = True
    &nbsp;&nbsp; Else
    &nbsp;&nbsp;&nbsp;&nbsp; cmd_goPrev.SetFocus
    &nbsp;&nbsp;&nbsp;&nbsp; cmd_goNext.Enabled = False
    &nbsp;&nbsp; End If
    End Sub

  8. #8
    Join Date
    Dec 2003
    Location
    The Netherlands
    Posts
    98

    No more error messages

    Thankyou so much! I quit using macro's and all of a sudden (after entering the code instead of most of the macro's I had) mysterious error messages disappear.

    THANKYOU.

Posting Permissions

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