Article ID: 141627
Article Last Modified on 1/19/2007
Option Explicit
Function GotoPreviousRecord()
On Error Goto GotoPreviousErrorHndlr
' Screen.ActiveForm.Name forces the GotoRecord action
' to be applied to the active form.
DoCmd.GoToRecord acForm, Screen.ActiveForm.Name, acPrevious
ExitGotoPreviousRecord:
Exit Function
GotoPreviousErrorHndlr:
MsgBox Error$
Resume ExitGotoPreviousRecord
End Function
Function GotoNextRecord()
On Error Goto GotoNextErrorHndlr
' Screen.ActiveForm.Name forces the GotoRecord action
' to be applied to the active form.
DoCmd.GoToRecord acForm, Screen.ActiveForm.Name, acNext
ExitGotoNextRecord:
Exit Function
GotoNextErrorHndlr:
MsgBox Error$
Resume ExitGotoNextRecord
End Function
In Microsoft Access 2.0:
Function GotoPreviousRecord()
On Error Goto GotoPreviousErrorHndlr
' Screen.ActiveForm.Name forces the GotoRecord action
' to be applied to the active form.
DoCmd GotoRecord A_FORM, Screen.ActiveForm.Name, A_PREVIOUS
ExitGotoPreviousRecord:
Exit Function
GotoPreviousErrorHndlr:
MsgBox Error$
Resume ExitGotoPreviousRecord
End Function
Function GotoNextRecord()
On Error Goto GotoNextErrorHndlr
' Screen.ActiveForm.Name forces the GotoRecord action
' to be applied to the active form.
DoCmd GotoRecord A_FORM, Screen.ActiveForm.Name, A_NEXT
ExitGotoNextRecord:
Exit Function
GotoNextErrorHndlr:
MsgBox Error$
Resume ExitGotoNextRecord
End Function
Private Sub Form_Timer()
Me![CurrentTime] = Now()
End Sub
This procedure updates the time in the CurrentTime control once every
second.
Macro Name Action
----------------------
{F2} GotoRecord
{F3} GotoRecord
{F2} Actions
-----------
GotoRecord
Record: Previous
{F3} Actions
-----------
GotoRecord
Record: Next
Keywords: kbprb KB141627