Quick Question about Me.Dirty (1 Viewer)

jcruzAME

Registered User.
Local time
Today, 14:12
Joined
Oct 5, 2011
Messages
135
If I understand correctly from what I just looked up, Me.Dirty checks to see if any changes have been made. I have a form that has text boxes and combo boxes (that I've changed both) and me.dirty still comes back false.

Although, the code is under Form_Unload. Would that affect if it comes back as true or false? Basically I just need it that if you didn't change anything then just close instead of running the code for if you change/add information.
 

boblarson

Smeghead
Local time
Today, 12:12
Joined
Jan 12, 2001
Messages
32,059
A form becomes Dirty if it is bound to a table or query and something has been changed, a record started, edited, etc.

You cannot check to see if a form is dirty in the form's UNLOAD event because by that time the form's Before Update event has already fired which in turn would fire the After Update event if allowed to continue. By the time you get to the Unload event (when the recordset is unloaded from the form) the time for Me.Dirty has way long passed.
 

spikepl

Eledittingent Beliped
Local time
Today, 21:12
Joined
Nov 3, 2010
Messages
6,142
On form unload any changes have been saved, so Dirty will always be false at this stage. If the form is not dirty, you don't need to do anything at all, since nothing will be saved when you close the form.
 

jcruzAME

Registered User.
Local time
Today, 14:12
Joined
Oct 5, 2011
Messages
135
Thanks for the replies guys, that's what I was thinking. I was kind of approaching this in the wrong way, almost have the problem fixed now.
 

Users who are viewing this thread

Top Bottom