Here's some code that i routinely use. It 'wraps' back to the first record when reaching the last record, and vice versa; when using the 'previous' button and reaching the first record, it then goes 'back' to the last record.
Code:
Private Sub Go2Next_Click()
If Me.CurrentRecord = Me.RecordsetClone.RecordCount Or Me.NewRecord = True Then
DoCmd.GoToRecord , , acFirst
Else
DoCmd.GoToRecord , , acNext
End If
End Sub
Code:
Private Sub Go2Prev_Click()
If Me.CurrentRecord = 1 Or Me.NewRecord = True Then
DoCmd.GoToRecord , , acLast
Else
DoCmd.GoToRecord , , acPrevious
End If
End Sub
You could replace the lines
DoCmd.GoToRecord , , acFirst
and
DoCmd.GoToRecord , , acLast
with messages boxes, if you prefer, instead of 'wrapping' the recordset.
Linq ;0)>
The problem with making anything foolproof...is that fools are so darn ingenious!
All posts/responses based on Access 2003/2007