Results 1 to 4 of 4
  1. #1
    2 Star Lounger
    Join Date
    Mar 2002
    Posts
    132
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Next Record (Access 200 VBA)

    I'm using the following code to move to the next record. Is there a way to check if the next record is new or to stop it from going to a new record.

    Private Sub btnNextRecord_Click()
    On Error GoTo Err_btnNextRecord_Click

    DoCmd.GoToRecord , , acNext

    Exit_btnNextRecord_Click:
    Exit Sub
    Err_btnNextRecord_Click:
    MsgBox Err.Description
    Resume Exit_btnNextRecord_Click

    End Sub

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

    Re: Next Record (Access 200 VBA)

    You can set the Allow Additions property of the form to No. The user won't be able to create new records.

  3. #3
    2 Star Lounger
    Join Date
    Mar 2002
    Posts
    132
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Next Record (Access 200 VBA)

    Sorry, more details required. I only want a new record created when they click the new button.

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

    Re: Next Record (Access 200 VBA)

    Do you have a "New" command button on your form? If so, you can use the following code in the On Click event of the button:

    Private Sub cmdNew_Click()
    Me.AllowAdditions = True
    RunCommand acCmdRecordsGoToNew
    End Sub

    and reset AllowAdditions in the After Insert event of the form:

    Private Sub Form_AfterInsert()
    Me.AllowAdditions = False
    End Sub

Posting Permissions

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