Dick7Access
Dick S
- Local time
- Today, 11:27
- Joined
- Jun 9, 2009
- Messages
- 4,331
I am tryhing to fully understand error handling. The code below I copied from someone else and it works fine in the db I have it in. In other db’s and in different code than next record I am trying to create error handling from scratch. Since ErrNumber 2105 refers to next record, what would I use with the procedure is not next record?
Code:
Private Sub cmdNext_Click() 'Lets user know he has reached last record
On Error GoTo err_handler
DoCmd.GoToRecord acForm, "frmMain", acNext
DoCmd.GoToControl "cmbSal"
cmdNext_Exit:
Exit Sub
err_handler:
If Err.Number = 2105 Then
MsgBox "You have already reached the Last student.", vbApplicationModal, "That's All Folks"
Else
MsgBox Err.Description, vbExclamation, "Error #: " & Err.Number
End If
Resume cmdNext_Exit
End Sub