S
Stephanie
Hello. I can't seem to trap this error!
I have a command button to take you to the next record. If there is not a
"next record" I'd like a message box stating "you've reached the end of the
list", instead of the dreaded "run-time error 2105 you can't go to the
specified record".
When I step through my code, the error doesn't seem to get pegged as 2105
and the message box doesn't appear. I must have something backwards! I'd
appreciate your help. Thanks!
Private Sub NextPP_Click()
Dim lngErr As Long
lngErr = Err.Number
If (lngErr <> 0) And (lngErr = 2105) Then
MsgBox "That's the last entry in the list.", _
vbInformation, "End of the list..."
Else
DoCmd.GoToRecord , , acNext
End If
On Error GoTo ProcError
ExitProc:
Exit Sub
ProcError:
MsgBox "Error " & Err.Number & ": " & Err.Description, , _
"Error in NextPP_Click procedure..."
Resume ExitProc
End Sub
I have a command button to take you to the next record. If there is not a
"next record" I'd like a message box stating "you've reached the end of the
list", instead of the dreaded "run-time error 2105 you can't go to the
specified record".
When I step through my code, the error doesn't seem to get pegged as 2105
and the message box doesn't appear. I must have something backwards! I'd
appreciate your help. Thanks!
Private Sub NextPP_Click()
Dim lngErr As Long
lngErr = Err.Number
If (lngErr <> 0) And (lngErr = 2105) Then
MsgBox "That's the last entry in the list.", _
vbInformation, "End of the list..."
Else
DoCmd.GoToRecord , , acNext
End If
On Error GoTo ProcError
ExitProc:
Exit Sub
ProcError:
MsgBox "Error " & Err.Number & ": " & Err.Description, , _
"Error in NextPP_Click procedure..."
Resume ExitProc
End Sub