Results 1 to 8 of 8
  1. #1
    2 Star Lounger
    Join Date
    Feb 2003
    Posts
    129
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Previos/Next Buttons (2002-SP3)

    I have buttons on a form to go to previous and next records.

    How can I stop the next button from going to create a new record when it gets to the end of the records.
    Here is the code for the button DoCmd.GoToRecord , , acNext

    If you click on the next button one more time you get a message that says that you can't go to the specified record. That's what I want instead of switching to a new record.

    Thanks

    Paul

  2. #2
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Sint Niklaas, Belgium
    Posts
    2,778
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Previos/Next Buttons (2002-SP3)

    Set the form property Allow Additions to No.
    Francois

  3. #3
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Previos/Next Buttons (2002-SP3)

    If you set the Allow Additions property of the form to No, the user won't be able to create a new record.

    If you add

    On Error Resume Next

    at the beginning of the code, the user won't get an error message if the button tries to go past the last record.

  4. #4
    2 Star Lounger
    Join Date
    Feb 2003
    Posts
    129
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Previos/Next Buttons (2002-SP3)

    Hans-

    I don't thin that solves my problem.

    I want the message - I just don't want it to go to new record before I get the message.

    Paul

  5. #5
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Previos/Next Buttons (2002-SP3)

    Why doesn't setting Allow Additions to No solve your problem? It'll prevent the user from going to a new record.

  6. #6
    2 Star Lounger
    Join Date
    Feb 2003
    Posts
    129
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Previos/Next Buttons (2002-SP3)

    That won't work because I do have a button on the form to add new records. I just didn't want the next button to take you to that screen.

  7. #7
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Previos/Next Buttons (2002-SP3)

    You can set AllowAdditions to True in the On Click event of your "Add record" button, before moving to the new record.
    Then set it to False again in the On Current event of the form.

  8. #8
    2 Star Lounger
    Join Date
    Feb 2003
    Posts
    129
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Previos/Next Buttons (2002-SP3)

    That will work.

    Thanks.

    Paul

Posting Permissions

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