[AccessD] Dirty property

Gustav Brock gustav at cactus.dk
Thu Jul 23 04:33:43 CDT 2015


Hi Bill et al

> and then where are ya?

Relax. I whining developer is not a nice picture.

If you cancel the BeforeUpdate event of the form, you will be where you were before trying to save the record. It doesn't matter how you try to save the record - explicitly or implicitly - it will not save.

So if you the user is able to save a record that shouldn't, the only reason is poor design of your validation routine. Whether the user tries to save the record, move to another record, or close the form should have no impact on the validation.

If you feel strongly against this behaviour, Access is not for you, as the automatic saving is a basic core design feature of the bound form of Access. 

That said there may be good reasons for not using bound forms, but then don't waste your time playing with this in Access - move to Visual Studio and, say, Winforms where you are in absolute control. It takes a little (maybe some more) and will present a never ending learning experience for you; but it may be more fun, and you have the pleasure to work in an environment that is built from the ground up for developers. It even comes in the free Community Version and now in version 2015.

/gustav

-----Oprindelig meddelelse-----
Fra: AccessD [mailto:accessd-bounces at databaseadvisors.com] På vegne af Bill Benson
Sendt: 23. juli 2015 03:55
Til: Access Developers discussion and problem solving
Emne: Re: [AccessD] Dirty property

True Darryl, from my limited testing. When closing the form, the only chance you have to intercept the saving of any information which may have changed in a bound control is the form's Before_Update event. However, that is the same event you would use to validate changes were the user to click Save. and you don't really know, is the user Saving or are they Closing, because neither Form_Unload not Form_Close has yet fired, and Access does not have a QueryClose (and even if it did, Before_Update would probably fire first." Of course if you have a specific Save command button, you can set a flag UserSaving so bypass the message about losing changes from closing the form - but then the user could go ahead and click the Save icon on the menu, and then where are ya? There is no Form_BeingSaved event. It's a nightmare. SAVVVVEEEE MEEEEE from bound controls! 



More information about the AccessD mailing list