Do Got Focus and Lost Focus DO anything?

B

BruceM

I have been rather frustrated by the inability to cause a form that serves
as a switchboard (my design, not the automated version) to do anything when
I open another form on top of it. First I couldn't keep it maximized (not
even with DoCmd.Maximize in the Load event, and DoCmd.Restore in various
other events. I solved this problem by dragging the borders of the normal
view until the form was, in effect, maximized.
Then I wanted to hide the Detail section so that when a form opens on top of
the switchboard the switchboard presents a blank background. I had thought
I could use the Lost Focus event to do Me.Detail.Visible = False, and vice
versa in the Got Focus event, but I discovered that even when I open another
form with its Modal property set to Yes (which should mean it has the focus,
and therefore the switchboard form doesn not), the switchboard's Lost Focus
event doesn't do anything. Same for Got Focus. I know I can hide the
Detail section, since I set up a command button to toggle its visible
property (as a test), but I can't seem to automate the process.
What am I missing?
 
M

missinglinq via AccessMonster.com

GotFocus and LostFocus are of minimal use for a form, as opposed to a control
on a form! The problem is that a form only has focus if :

1) it has no controls on it that can receive focus

or

2) all controls on it that can receive focus are disabled.

You might try Private Sub Form_Activate() and Private Sub Form_Deactivate()

The Activate event occurs when an object becomes the active window. The
Deactivate event occurs when an object is no longer the active window.
 
B

BruceM

Well, huh! That did it. Thanks. Hard to see where those Focus events
would be put to use. Maybe an information form that has only a label with
some information, or something like that, as long as it doesn't have a Close
button.
 
M

missinglinq via AccessMonster.com

Exactly. BTW, if you use, say, YourForm.SetFocus, and the form has controls
on it that are enabled, it actually set focus on the LAST CONTROL on the form
that received focus, rather than on the form itself!

--
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

Similar Threads

Cancel On Lost Focus Event 3
Maximize ONLY frm_Me 2
Lost Focus Woes 7
lost focus 6
Tab Control - How to detect which tab got focus ? 3
Lost My Focus 3
Close on Lost Focus 2
Lost Focus or On Deactivate 4

Top