And for the "Henny Pennies" out there who will insist that the sky is falling
and this can possibly cause another type of error, this modification checks
for the specific error and runs the "wrap" code:
Private Sub Go2First_Click()
On Error GoTo Err_Go2First_Click
DoCmd.GoToRecord , , acFirst
Exit_Go2First_Click:
Exit Sub
Err_Go2First_Click:
MsgBox Err.Description
Resume Exit_Go2First_Click
End Sub
Private Sub Go2Next_Click()
On Error GoTo Err_Go2Next_Click
DoCmd.GoToRecord , , acNext
[ClientName].SetFocus
Exit_Go2Next_Click:
Exit Sub
Err_Go2Next_Click:
If Err.Number = 2105 Then
DoCmd.GoToRecord , , acFirst
Else
MsgBox Err.Description
Resume Exit_Go2Next_Click
End If
End Sub
Private Sub Go2Last_Click()
On Error GoTo Err_Go2Last_Click
DoCmd.GoToRecord , , acLast
Exit_Go2Last_Click:
Exit Sub
Err_Go2Last_Click:
MsgBox Err.Description
Resume Exit_Go2Last_Click
End Sub
Private Sub Go2Prev_Click()
On Error GoTo Err_Go2Prev_Click
DoCmd.GoToRecord , , acPrevious
Exit_Go2Prev_Click:
Exit Sub
Err_Go2Prev_Click:
If Err.Number = 2105 Then
DoCmd.GoToRecord , , acLast
Else
MsgBox Err.Description
Resume Exit_Go2Prev_Click
End If
End Sub
--
There's ALWAYS more than one way to skin a cat!
Answers/posts based on Access 2000/2003
Message posted via AccessMonster.com