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?
missinglinq - 15 Mar 2007 14:54 GMT
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.

Signature
There's ALWAYS more than one way to skin a cat!
Answers/posts based on Access 2000
BruceM - 15 Mar 2007 15:40 GMT
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.
> GotFocus and LostFocus are of minimal use for a form, as opposed to a
> control
[quoted text clipped - 11 lines]
> The Activate event occurs when an object becomes the active window. The
> Deactivate event occurs when an object is no longer the active window.
missinglinq - 15 Mar 2007 16:03 GMT
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!

Signature
There's ALWAYS more than one way to skin a cat!
Answers/posts based on Access 2000