Code Examples

Move To Next Record

acCmdRecordsGoToNext

This code moves the cursor to the next record. It is designed to run behind a button called cmdNext.

'***************** Code Start *******************
' This code was originally written by Terry Wickenden.
' It is not to be altered or distributed,
' except as part of an application.
' You are free to use it in any application,
' provided the copyright notice is left unchanged.

Private Sub cmdNext_Click()

  On Error GoTo ErrNext

  DoCmd.RunCommand acCmdRecordsGoToNext
  Exit Sub

ErrNext:

  Select Case Err
    Case 2046
      'Command not available
      MsgBox "You cannot goto next record as you are on the last record." , _
        vbInformation, "Not Available"
    Case Else
      MsgBox Err.Number & ":-" & vbCrLf & Err.Description
  End Select

End Sub

'****************** Code End ********************

© 1998 - 2011 Terry Wickenden TKW Design Site developed maintained and hosted by TKW Design. This site is best viewed at 1024 x 768. Optimised for Firefox.