I have a Main Form, which also contains a SUB FORM. My SUB FORM contains Text Boxes and Check Boxes. CANCEL button on the MAIN FORM only undo's the data on the MAIN FORM. Kindly tell me a way to UNDO the changes in SUB FORM as well using the same CANCLE button on the MAIN FORM.
I tried to find an answer in the questions asked in the past, but i found it difficult to understand, as i am a rookie. Please help.
I have seen that 1st CODE Undo's all the changes in MAIN FORM.
Expand|Select|Wrap|Line Numbers
- Private Sub Cancel_Click()
- On Error GoTo Err_Cancel_Click
- Me.Undo
- DoCmd.Close
- Exit_Cancel_Click:
- Exit Sub
- Err_Cancel_Click:
- MsgBox Err.Description
- Resume Exit_Cancel_Click
- End Sub
Expand|Select|Wrap|Line Numbers
- Private Sub Cancel_Click()
- On Error Resume Next
- Application.Echo (False)
- Me!Spec.SetFocus
- DoCmd.RunCommand (acCmdUndo)
- Me!Cancel.SetFocus
- Application.Echo (True)
- DoCmd.Close
- End Sub
Thanks in advance!!
Regards,
Anjani