beenut23
Technical User
- Aug 17, 2008
- 8
Hello. I ave a form on which I must check if the user has changed anything on both the form and the subform. my nested if statement is wrong, I can tell, because it doesn't work at all. Before I added the two blue lines, it was fine if changes were on the form, but didn't check the subform too. I need it to check both, but don't know the correct order of events.
many thanks for any assistance with this.
Code:
If Me.Dirty Then
[blue]If Me![tblNameDetails subform].Form.Dirty Then[/blue]
Select Case MsgBox("Do you want to save changes?", vbYesNoCancel)
Case vbYes
'// If yes then, Save record and then close
Forms![frmAddNewCase]![subfrmCaseWitnesses].Form.Requery
DoCmd.Close
Case vbNo
'// If no then Undo Changes then close
DoCmd.RunCommand acCmdUndo
DoCmd.Close
Case Else
'// Do nothing
End Select
Else
'// If not dirty then just close
DoCmd.Close
[blue]End If[/blue]
End If
many thanks for any assistance with this.