Iv got Next and Previous buttons, both of which work. When I get to the start of the record set my error message appears which is great. but when i get to the end of the record set, my error message does not appear. Here is my code, im sure its just a little thing i need to change but I just cant find it:
'This goes to the next record
Private Sub cmdNext_Click()
On Error GoTo Err_bNext_Click
If Me.Dirty Then
MsgBox "Please save the changes to the record." & vbCrLf & vbLf & "You can not advance from this record until you Save the changes made, or Delete the record.", vbExclamation, "Save Required"
ElseIf Me.CurrentRecord < Me.RecordsetClone.RecordCount Then
DoCmd.GoToRecord , , acNext
End If
Exit_bNext_Click:
Exit Sub
Err_bNext_Click:
MsgBox "Please click Previous to view previous records.", vbExclamation, "End of Record Set"
Resume Exit_bNext_Click
End Sub
'This goes to the previous code
Private Sub cmdPrevious_Click()
On Error GoTo Err_bPrevious_Click
If Me.Dirty Then
MsgBox "Please save the changes to the record." & vbCrLf & vbLf & "You can not advance from this record until you Save the changes made, Delete the record or Undo the changes made.", vbExclamation, "Save Required"
ElseIf Me.CurrentRecord <= Me.RecordsetClone.RecordCount Then
DoCmd.GoToRecord , , acPrevious
End If
Exit_bPrevious_Click:
Exit Sub
Err_bPrevious_Click:
MsgBox "Please click Next to view more records.", vbExclamation, "Start of Record Set"
Resume Exit_bPrevious_Click
End Sub
'This goes to the next record
Private Sub cmdNext_Click()
On Error GoTo Err_bNext_Click
If Me.Dirty Then
MsgBox "Please save the changes to the record." & vbCrLf & vbLf & "You can not advance from this record until you Save the changes made, or Delete the record.", vbExclamation, "Save Required"
ElseIf Me.CurrentRecord < Me.RecordsetClone.RecordCount Then
DoCmd.GoToRecord , , acNext
End If
Exit_bNext_Click:
Exit Sub
Err_bNext_Click:
MsgBox "Please click Previous to view previous records.", vbExclamation, "End of Record Set"
Resume Exit_bNext_Click
End Sub
'This goes to the previous code
Private Sub cmdPrevious_Click()
On Error GoTo Err_bPrevious_Click
If Me.Dirty Then
MsgBox "Please save the changes to the record." & vbCrLf & vbLf & "You can not advance from this record until you Save the changes made, Delete the record or Undo the changes made.", vbExclamation, "Save Required"
ElseIf Me.CurrentRecord <= Me.RecordsetClone.RecordCount Then
DoCmd.GoToRecord , , acPrevious
End If
Exit_bPrevious_Click:
Exit Sub
Err_bPrevious_Click:
MsgBox "Please click Next to view more records.", vbExclamation, "Start of Record Set"
Resume Exit_bPrevious_Click
End Sub