View Full Version : Check Dirty property in Subform


falguy
09-04-2001, 08:47 AM
I am having trouble checking the "Dirty" property in a subform. The AfterUpdate event fires and I have verified that the value of the field has changed. I tried using "Me.Dirty" and Forms![frmMasterAccounts]![frmSubAccounts].Form.Dirty, but they both return "False". Any other suggestions?

Pat Hartman
09-04-2001, 01:20 PM
If you are talking about the AfterUpdate event of the form, the record is no longer dirty since Access has already saved it.

If you want to trap errors, you need to do it in the BeforeUpdate event of the form. Then you can cancel the update if any errors are found.

BTW, the BeforeUpdate event of the form ONLY executes when the record is dirty so you don't need to check the form's dirty property.

falguy
09-05-2001, 06:02 AM
Thanks for the help Pat. It should have been BeforeUpdate - I don't know why I wrote AfterUpdate. My code is in the BeforeUpdate event.

I never even thought about why I was checking the Dirty property. The example code I used from Microsoft had the Dirty check in it and I just copied it without thinking. I might as well take it out and my problem will be solved.



[This message has been edited by falguy (edited 09-05-2001).]