Form GotFocus event doesnt fire

G

Guest

Hello and thanks in advance.

I can't seem to get a main form's GotFocus event to fire. I have a few
detail forms that are opened in acDialog mode, and figured that after the
main form got the focus (when the detail is closed) that I could put a
requery cmd in the GotFocus event. Doesn't seem to be working. I put a
msgbox in the gotfocus of the form to check and see where it would fire, and
I didn't get anything coming back from any detail forms or even when the form
opens. Does this seem right??

Thanks,
Jack
 
R

Rick Brandt

Dymondjack said:
Hello and thanks in advance.

I can't seem to get a main form's GotFocus event to fire. I have a
few detail forms that are opened in acDialog mode, and figured that
after the main form got the focus (when the detail is closed) that I
could put a requery cmd in the GotFocus event. Doesn't seem to be
working. I put a msgbox in the gotfocus of the form to check and see
where it would fire, and I didn't get anything coming back from any
detail forms or even when the form opens. Does this seem right??

Thanks,
Jack

The help file specifically states that a form's GotFocus event does not fire
when closing a dialog form.

If you are using the acDialog argument then that will pause code in your main
form. Therefore all you need to do is add the Requery commamd on the line
immediately following the one that opens the dialog form. It will not fire
until the dialog form is closed.
 
G

Guest

Sorry.. apparently that was a stupid question that I could have found an
answer on elsewhere without bother you guys...
 
L

Linq Adams via AccessMonster.com

Also, a form *never* receives focus if there are any controls on it with
enabled/visible set to True! In other words, if there's a single control that
can receive focus, the form never will!

Confusing, isn't it?

Linq
Sorry.. apparently that was a stupid question that I could have found an
answer on elsewhere without bother you guys...
[quoted text clipped - 16 lines]
immediately following the one that opens the dialog form. It will not fire
until the dialog form is closed.

--
There's ALWAYS more than one way to skin a cat!

Answers/posts based on Access 2000

Message posted via AccessMonster.com
 
G

Guest

Makes sense, that the form itself would only get the focus if there is no
control to take it instead. I had figured that first the form would, and
then the control. In any case, Rick pointed me in the right direction for my
requery, but this is a nice piece of information to know. I can see where it
will save me a lot of future issues. Thanks

Linq Adams via AccessMonster.com said:
Also, a form *never* receives focus if there are any controls on it with
enabled/visible set to True! In other words, if there's a single control that
can receive focus, the form never will!

Confusing, isn't it?

Linq
Sorry.. apparently that was a stupid question that I could have found an
answer on elsewhere without bother you guys...
Hello and thanks in advance.
[quoted text clipped - 16 lines]
immediately following the one that opens the dialog form. It will not fire
until the dialog form is closed.

--
There's ALWAYS more than one way to skin a cat!

Answers/posts based on Access 2000

Message posted via AccessMonster.com
 
L

Linq Adams via AccessMonster.com

I've answered boat loads of posts over the years where people had spent hours
trying to figure out why the form's gotfocus or lostfocus event wasn't firing.
About the only type form where it would get/lose focus would be maybe a
splash form that appears when a db opens, or a menu type form, if you use the
click event of labels (which can't receive focus) instead of command buttons
for navigation to yur forms/reports. A way to trick Access in this matter, if
it becomes vital, is to place a *phantom* control on the form. Locate it in
the left-hand lower secion of the form, up against the form's border, then
minimize it until it's virtually invisible. In the Tab Order set this control
as the first one to receive focus, then use the control's GotFocus event to
do your dirty work! When the form opens this *phantom* control will receive
the focus and bob's your uncle!

Linq ;0)>

--
There's ALWAYS more than one way to skin a cat!

Answers/posts based on Access 2000

Message posted via AccessMonster.com
 

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