In message <GQ*******************@fe2.columbus.rr.com>, Tim
<tg@neo.rr.com> writes
I have used a graphic 'next record' button on a form. How can I stop it
from going past the last existing record? In other words, I don't want it
to take the user to a blank record.
This code traps that specific error and beeps if the user attempts to go
beyond the last record. The code is in the On Click event handler for a
control called GoNext.
--------------8<--------------------------------------------------8<-----
--------
Private Sub GoNext_Click()
On Error GoTo Err_GoNext_Click
DoCmd.GoToRecord , , acNext
Exit_GoNext_Click:
Exit Sub
Err_GoNext_Click:
If Err = 2105 Then
Beep
Else
MsgBox (Str(Err) & " - " & Err.DESCRIPTION)
End If
Resume Exit_GoNext_Click
End Sub
--
Bernard Peek
London, UK. DBA, Manager, Trainer & Author. Will work for money.