I'm trying to undo changes on a sub form if the property 'Dirty' has been triggered but as soon as you move from the sub form back to the main form the 'Dirty' property is reset and the undo on the docmd is no longer usable, any suggestion?
Hmm, that makes sense.. Maybe instead of an undo, then you could use a method for deleting the last entered record if need be. Or are you wanting to "undo" the record from the table, or just clear the controls on the form? Clearing the controls on the form is actually not too difficult. I've picked up some code/ideas from a few different posts in here, a couple of which is where I asked for help on the subject. I have had some info from a few different users in here.. Here is an example of how you could do it (clearing the controls on the form/subform:
Code:
Private Sub cmdClearFormButton_Click()
Dim ctl as Control
Dim frm as Form
For Each ctl In frm.Controls
If TypeOf ctl is vbComboBox or vbTextBox or vbListBox Then
ctl = vbNullString
End If
Next ctl
End Sub
Of course, I may not have the TypeOf list of names correct there, but you could easily find the correct context if that is not 100% correct.
Stephen
"Jesus saith unto him, I am the way, the truth, and the life:
no man cometh unto the Father, but by me." John 14:6 KJV
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.