I have created manual navigation buttons for a Maintenance form that has Contract Data in the Main Form with Participant Data in a subform that is linked to the Main form by a unique identifier. I want the user to be stopped if they have changed any record from automatically saving. I have attached the following to the on click event:
Private Sub btngonextmaint_Click()
If Me.Dirty = True Then
MsgBox "Must Save Changes before changing Records"
ElseIf Me!frmProviderMaint.Form.Dirty = True Then
MsgBox "Must Save Changes before changing Records"
Exit Sub
Else: On Error GoTo ErrorHandler
DoCmd.GoToRecord , , acNext
Exit Sub
End If
ErrorHandler:
MsgBox "You have reached the Last Record"
End Sub
This seems to work to stop advancing on the main form but is not working on the subform. What am I missing?
Private Sub btngonextmaint_Click()
If Me.Dirty = True Then
MsgBox "Must Save Changes before changing Records"
ElseIf Me!frmProviderMaint.Form.Dirty = True Then
MsgBox "Must Save Changes before changing Records"
Exit Sub
Else: On Error GoTo ErrorHandler
DoCmd.GoToRecord , , acNext
Exit Sub
End If
ErrorHandler:
MsgBox "You have reached the Last Record"
End Sub
This seems to work to stop advancing on the main form but is not working on the subform. What am I missing?