On Dirty Event

  • Thread starter Thread starter Reggie
  • Start date Start date
R

Reggie

Hi and TIA. I have a form in Single form view. Once the user changes a
value the OnDirty event fires as expected, They click my save button to save
the record it is saved. Now they see that they want to change something else
on the same form/same record. When they do this the OnDirty event does not
fire. Any suggestions are appreciated. Thanks!
 
If you change the process slightly to this:
The Save button has code like this:

If Me.Dirty = True Then
Me.Dirty = False
End If
DoCmd.Close acForm, Me.Name

You wouldn't have any worries with the OnDirty event.

When user saves the record, the form closes.
If they want to go back and change something,
they just choose the record to edit and the whole process runs through
again.

The above process makes it easy for the developer.
If the form is not dirty, nothing is saved.
If user has made changes, they can press Esc once to clear a textbox or
combo, twice to clear all the changes to the record.


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia
 
Reggie,

I had to assume that you are talking about the "dirty" property of your
form. You did not say just what code you have on your save button that is
saving the record. If the record is truly saved and no longer dirty, then
any change to anything on the form should cause the On Dirty event to fire.

Also, what version of Access are you using?

-----
HTH
Mr. B
http://www.askdoctoraccess.com/
Doctor Access Downloads Page:
http://www.askdoctoraccess.com/DownloadPage.htm
 
Thanks Jeanette. I knew I could do this but was wanting to leave the focus
in the form on that record (my customers request). My problem is that I
hide/disable controls on the form when the record is dirty. It works fine
the first time it becomes dirty, but after they save it and if they start
editing the record again the ondirty event does not fire and therefore I
can't capture that event to disable/hide my controls. Thanks!

--

Reggie
Jeanette Cunningham said:
If you change the process slightly to this:
The Save button has code like this:

If Me.Dirty = True Then
Me.Dirty = False
End If
DoCmd.Close acForm, Me.Name

You wouldn't have any worries with the OnDirty event.

When user saves the record, the form closes.
If they want to go back and change something,
they just choose the record to edit and the whole process runs through
again.

The above process makes it easy for the developer.
If the form is not dirty, nothing is saved.
If user has made changes, they can press Esc once to clear a textbox or
combo, twice to clear all the changes to the record.


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia
 
Mr. B, you are correct in your assumption. I stand corrected. It is
working now. I think when I put it in break mod or something like that was
causing it not to fire. At any rate it is doing as I expected it to do.
Thanks for your (wasted) time.
 
Back
Top