Kill Focus on Subform

J

jschping

Hi,

I have a main form with a bunch of subforms, let's call them A through G.

Each subform has its own group of subforms, let's call them 1-4.

So I have tons of subforms, like A1, B4, D3, etc.

I have some code that cycles through all the lowest level subforms (like
A3), and makes some visible and others invisible. I always hit an error that
"You can't hide a control that has the focus."

I have desperately tried to set the focus elsewhere so I won't get the error
but it doesn't work. If I try to set the focus to a different subform I get
the error of "Microsoft Access can't move the focus to control Child47."
(Child47 is the name of the subform.)

I'm losing my mind. Any ideas?

Thanks!!

John Schping
 
T

Tom van Stiphout

On Wed, 17 Mar 2010 09:55:01 -0700, jschping

Why not keep focus on the main form?
Assuming your code runs in the main form:
Me.SetFocus
Me.myAlwaysVisibleControl.SetFocus
'show and hide your subsubforms here.

-Tom.
Microsoft Access MVP
 
M

Maurice

What would be the trigger that makes the subform or control not visbile? You
might expect that it isn't possible to set a control (or object) to invisble
when in fact it has the focus. So describe the functionality what you are
trying to achive as follows:

when this happens the following should be inactive or set to invisble, also
describe where the focus is at that point. That might give us some more info.
 

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