Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to find out if data was modified... Form.Dirty??? 1

Status
Not open for further replies.

waldemar

Programmer
Nov 15, 2001
245
DE
What is the handling of the form property DIRTY ??

On closing the form (a modal one) I would like to find out if the data was changed or not.

I would like to avoid decorating eeeevery control After_Update() Event with something like "blnChanged=True"... isn't this what DIRTY is for? However DIRTY always responds with FALSE...
 
You're almost there. However you have to test the dirty propery of the form on the BEFOREUPDATE event of the form, as its at this point BEFORE the UPDATE that the form will be "dirty" if any data in the current record has been changed.

Once the record is updated and the AFTERUPDATE event fires, it's too late ... the updates have been applied, you have a fresh "clean" copy of the data, and the dirty property will always be false; hense use this form level property in the BeforeUpdate event.

Hope this helps,
Cheers,

Steve Lewy
Solutions Developer
steve@lewycomputing.com.au
 
I am learing - It seems that the dirty property will tell you if there was something changed on the forms data ? Is that correct? If so, in what capacity would you want to know that -

Thanks for the insight!
 
Well, for example, if something has changed, you might want to warn the user that the changes will become permanent when he leaves the record, just in case he/she wants to change their mind, or ... you might want to keep track of the number of records that are changed during a session, or you might want to write an audit record to another table with details of who made the change. Lots of good reasons around really.
Cheers,

Steve Lewy
Solutions Developer
steve@lewycomputing.com.au
 
Foe example, I have a seperate (modal) form for any address that appears in the application. When any changes are made to an address a text file has to be kept up to date and an email has to be sent to somebody...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top