Close button doesn't fire if subform has focus

G

Guest

Access 2003. I've got a form that has a subform that displays a bunch of
detail information for the record on my main form.

On my main form, I have a close command button that does not appear to fire
the click event if the previous control was a control inside the subform. I
have some code in the exit event of the sub_form control (on the main form)
and that code fires when I click on the Close button, but I would have
thought that depressing the close button would cause the sub-forms Exit event
to fire, followed by the click event of the Close button.

When I click the Close button while a control on the main form has the
focus, the Close buttons Click event fires correctly. Anybody have any idea
what is going on, and how to get around it?
 
B

Bob Hairgrove

Access 2003. I've got a form that has a subform that displays a bunch of
detail information for the record on my main form.

On my main form, I have a close command button that does not appear to fire
the click event if the previous control was a control inside the subform. I
have some code in the exit event of the sub_form control (on the main form)
and that code fires when I click on the Close button, but I would have
thought that depressing the close button would cause the sub-forms Exit event
to fire, followed by the click event of the Close button.

When I click the Close button while a control on the main form has the
focus, the Close buttons Click event fires correctly. Anybody have any idea
what is going on, and how to get around it?

The only thing that comes to my mind right away is the possibility that the code
in your subform's OnExit event somehow sets the focus to a different control or
form section before your Close button can get the focus. Is that possible?
 
G

Guest

Actually, that is quite possible. I'll take a look in the morning.

Thanks for your input.
 

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