From: Afrosheen via AccessMonster.com on 16 Feb 2010 16:47 Hello John, we meet again. I probably then should put it in the LostFocus control. Thanks John W. Vinson wrote: >>Thanks for getting back so fast. The statement will work is I press the space >>bar then enter. If I just press enter the beforeupdate will not fire. It just >>goes to the next field > >That's correct. BeforeUpdate fires only when there is an update - i.e. when >something (anything other than just a <tab> or <enter>) has been typed into >the control. > >If you want the code to run even if the user sets focus to the control and >leaves it without doing anything at all, you'll need to use the LostFocus >event; if you want it to run even if the user just LOOKS at the control and >does nothing with it, I don't think you can! > -- Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/Forums.aspx/access-queries/201002/1
From: Marshall Barton on 16 Feb 2010 17:50
But, you can't cancel the LostFocus or Exit events. You also can't use Set Focus in the LostFocus event. so you may have to use the Exit event. However, users (certainly most that I know) can get frustrated with that kind of UI. Most recommendations strongly favor using the FORM's BeforeUpdate event to check the validity of all fields before saving the record. -- Marsh MVP [MS Access] Afrosheen via AccessMonster.com wrote: >I probably then should put it in the LostFocus control. > > >John W. Vinson wrote: >>>Thanks for getting back so fast. The statement will work is I press the space >>>bar then enter. If I just press enter the beforeupdate will not fire. It just >>>goes to the next field >> >>That's correct. BeforeUpdate fires only when there is an update - i.e. when >>something (anything other than just a <tab> or <enter>) has been typed into >>the control. >> >>If you want the code to run even if the user sets focus to the control and >>leaves it without doing anything at all, you'll need to use the LostFocus >>event; if you want it to run even if the user just LOOKS at the control and >>does nothing with it, I don't think you can! |