Results 1 to 6 of 6
  1. #1
    Lounger
    Join Date
    Dec 2003
    Posts
    38
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Navigation buttones (Access 2000)

    I have 2 buttons on my form, for navigation in the form Customers.True, i can navigate in the form, but when i reach the last record in my
    form, the button is allowed to navigate further and creates blank fields for new records
    which means i create false new customers. How can i avoid this problem ?

    Private Sub CmdBack_Click()
    On Error GoTo Err_CmdFro_Click
    DoCmd.GoToRecord , , acPrevious
    Exit_CmdFro_Click:
    Exit Sub
    Err_CmdFro_Click:
    MsgBox Err.Description
    Resume Exit_CmdFro_Click
    End Sub

    Private Sub CmdOn_Click()
    On Error GoTo Err_CmdOn_Click
    DoCmd.GoToRecord , , acNext
    Exit_CmdOn_Click:
    Exit Sub
    Err_CmdOn_Click:
    MsgBox Err.Description
    Resume Exit_CmdOn_Click
    End Sub

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

    Re: Navigation buttones (Access 2000)

    If you don't want the user to be able to create a new customer, set the Allow Additions property of the form to No. This property is in the Data tab of the Properties window.

  3. #3
    Silver Lounger
    Join Date
    Jun 2002
    Location
    Cheadle, Staffordshire
    Posts
    2,177
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Navigation buttones (Access 2000)

    Jim
    You have an error here in your button code, I think you have copied code from another button and pasted back into this one.
    It should be :

    On Error GoTo Err_CmdBack_Click

    And so forth in each occurance of CmdFro

    Private Sub CmdBack_Click()
    On Error GoTo Err_CmdFro_Click
    DoCmd.GoToRecord , , acPrevious
    Exit_CmdFro_Click:
    Exit Sub
    Err_CmdFro_Click:
    MsgBox Err.Description
    Resume Exit_CmdFro_Click
    End Sub

  4. #4
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Navigation buttones (Access 2000)

    It isn't necessarily an error, Dave. It looks like the button was renamed. In fact, the code should work just fine as long as it's internally consistent. The name of the error label is Err_cmdFro_Click, regardless of what the button name is.
    Charlotte

  5. #5
    Silver Lounger
    Join Date
    Jun 2002
    Location
    Cheadle, Staffordshire
    Posts
    2,177
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Navigation buttones (Access 2000)

    Yes Charlotte you're right, I could have been misleading there.
    The GoTo command takes care of all that, for the action would fire anyway as long as the parameter CmdFro existed later in the code.

    It just looked incorrect on first seeing it. <img src=/S/cheers.gif border=0 alt=cheers width=30 height=16>

  6. #6
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Navigation buttones (Access 2000)

    It *is* incorrect from a format and maintenance point of view, simply because it is confusing. It just won't break the code. <img src=/S/shrug.gif border=0 alt=shrug width=39 height=15>
    Charlotte

Posting Permissions

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