Cant detect lost focus when moving to parent form

R

RobGMiller

Access 2003

There is a main form and a subform.

There is a masked control that has to be filled before anything else.

If the control is not filled properly, the user needs a message.

A move off the control to different control on the subform the On Exit or
Lost focus events fires which allows a test of the value and appropriate
message. The On exist event cancel value will prevent moving off the control
if necessary.

If the control looses focus to a control on the parent or main form then
none of the event that normally fire when moving to a control on the same
form will fire. However, some of them will fire normally if the main form is
closed for instance by using the Close Button in the control box.

Is this normal or expected behavior. One would expect that when a control
looses focus, no matter it is or where the new focus is set, its LostFocus or
OnExit events should fire.

Can there be a configuration issue that I am not aware of.

By the way this application will have to function as an MDE from a runtime
version of Access 2003.

Thanks in advance.....
 
R

Rick Brandt

RobGMiller said:
Access 2003

There is a main form and a subform.

There is a masked control that has to be filled before anything else.

If the control is not filled properly, the user needs a message.

A move off the control to different control on the subform the On Exit or
Lost focus events fires which allows a test of the value and appropriate
message. The On exist event cancel value will prevent moving off the control
if necessary.

If the control looses focus to a control on the parent or main form then
none of the event that normally fire when moving to a control on the same
form will fire. However, some of them will fire normally if the main form is
closed for instance by using the Close Button in the control box.

Is this normal or expected behavior. One would expect that when a control
looses focus, no matter it is or where the new focus is set, its LostFocus or
OnExit events should fire.

Can there be a configuration issue that I am not aware of.

By the way this application will have to function as an MDE from a runtime
version of Access 2003.

Thanks in advance.....

In a form/subform setup the main form and all subforms can have a control with
focus at the same time. So while your subform might be losing focus to the main
form, the control you were in on the subform has not lost focus. It is still
considered to be the control that has focus (on the subform).

You might get what you want by calling the same code in the LostFocus event of
the subform.
 
R

RobGMiller

Thanks for the reply Rick.

I found that the SubForm container OnExit will do the trick nicely because
it will prevent moving off the control with a cancel parameter.
 
M

Marshall Barton

RobGMiller said:
Access 2003

There is a main form and a subform.

There is a masked control that has to be filled before anything else.

If the control is not filled properly, the user needs a message.

A move off the control to different control on the subform the On Exit or
Lost focus events fires which allows a test of the value and appropriate
message. The On exist event cancel value will prevent moving off the control
if necessary.

If the control looses focus to a control on the parent or main form then
none of the event that normally fire when moving to a control on the same
form will fire. However, some of them will fire normally if the main form is
closed for instance by using the Close Button in the control box.

Is this normal or expected behavior. One would expect that when a control
looses focus, no matter it is or where the new focus is set, its LostFocus or
OnExit events should fire.

Can there be a configuration issue that I am not aware of.

By the way this application will have to function as an MDE from a runtime
version of Access 2003.


If the subform is bound, maybe a better place to check is
its BeforeUpdate event (not the controls event).

If all else fails, use the subform control's Exit event.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top