G
Guest
I have learn so much from these newsgroups so thanks in advance.
I have a Form with a subform.
I have navigation buttons which check if the Main Form is dirty before
moving on
I have tried to do the same for the subform but it does not work.
Here is the code from the Next button
Private Sub cmdNext_SORMARec_Click()
On Error GoTo Err_cmdNext_SORMARec_Click
'Check for changes before Moving On & Prompt User
'Check if it has been updated
If lblUpdated.Caption = "Updated" Then
DoCmd.GoToRecord , , acNext
lblUpdated.Caption = " "
End If
'If not updated then check for bad entries
If Me.Dirty Then
' Prompt to confirm the save operation.
If MsgBox("Data has changed " & vbCrLf & "Do you want to save ? ",
vbYesNo + vbQuestion, _
"Data Changed") = vbNo Then
Me.Undo
End If
'Check for dirty subform - Not Working!
If Me.RS_Results_subform.Form.Dirty Then
' Prompt to confirm the save operation.
If MsgBox("Data has changed " & vbCrLf & "Do you want to save ? ",
vbYesNo + vbQuestion, _
"Data Changed") = vbNo Then
Me.Undo
End If
End If
End If
DoCmd.GoToRecord , , acNext
Exit_cmdNext_SORMARec_Click:
Exit Sub
Err_cmdNext_SORMARec_Click:
MsgBox Err.Description
Resume Exit_cmdNext_SORMARec_Click
End Sub
The first two work OK, but the second "If Me.RS_Results_subform.Form.Dirty
Then" just gets ignored.
I have tried using "If
Forms!sorma_records_Edit.RS_Results_subform.Form.Dirty Then" but this is also
ignored
so changes to the subform are saved without being questioned.
Any Ideas where I'm going wrong?
I will nest the if thens when happy it's working.
--
Cheers
Chas
***************
* Spectrum is Green *
***************
I have a Form with a subform.
I have navigation buttons which check if the Main Form is dirty before
moving on
I have tried to do the same for the subform but it does not work.
Here is the code from the Next button
Private Sub cmdNext_SORMARec_Click()
On Error GoTo Err_cmdNext_SORMARec_Click
'Check for changes before Moving On & Prompt User
'Check if it has been updated
If lblUpdated.Caption = "Updated" Then
DoCmd.GoToRecord , , acNext
lblUpdated.Caption = " "
End If
'If not updated then check for bad entries
If Me.Dirty Then
' Prompt to confirm the save operation.
If MsgBox("Data has changed " & vbCrLf & "Do you want to save ? ",
vbYesNo + vbQuestion, _
"Data Changed") = vbNo Then
Me.Undo
End If
'Check for dirty subform - Not Working!
If Me.RS_Results_subform.Form.Dirty Then
' Prompt to confirm the save operation.
If MsgBox("Data has changed " & vbCrLf & "Do you want to save ? ",
vbYesNo + vbQuestion, _
"Data Changed") = vbNo Then
Me.Undo
End If
End If
End If
DoCmd.GoToRecord , , acNext
Exit_cmdNext_SORMARec_Click:
Exit Sub
Err_cmdNext_SORMARec_Click:
MsgBox Err.Description
Resume Exit_cmdNext_SORMARec_Click
End Sub
The first two work OK, but the second "If Me.RS_Results_subform.Form.Dirty
Then" just gets ignored.
I have tried using "If
Forms!sorma_records_Edit.RS_Results_subform.Form.Dirty Then" but this is also
ignored
so changes to the subform are saved without being questioned.
Any Ideas where I'm going wrong?
I will nest the if thens when happy it's working.
--
Cheers
Chas
***************
* Spectrum is Green *
***************