Disabling subform controls

P

Patrick McGuire

I have a procedure in my form that disables all the
controls on a subform of the form. It works fine as long
as the user has not done anything to make any of the
subform's controls receive focus; however, it obviously
fails if a subform control DOES have focus. The problem
is that I don't know where I can send the focus prior to
disabling the controls, as there are no other controls on
the subform that I want to remain enabled. Any advice?

Pat
 
A

Allen Browne

Don't know if this would work, but you could try selecting the record
instead of a contro:
RunCommand acCmdSelectRecord
 
G

George Nicholson

Pat:

Send focus back to the Parent Form? (Assuming that the Parent has enabled
controls, this will automatically send focus to whichever one of them had
the focus last). I mean, SOMETHING has to have focus, and if you don't want
it on the subform, what else is available?

Also, you may want to consider this (if you haven't already): you may be
able to get the effect you want by simply disabling the subform control
itself (i.e., the control that contains the subform) rather than each
individual control on the subform. In either case, you still need to
address the focus issue.

Hope this helps,
 
P

Patrick McGuire

Sorry, but your solution won't work. Each form tracks
its own control focus. So if, for example, the procedure
runs in response to a button on the form being clicked
(i.e., the form's command button receives the form's
focus), the control on the subform that had focus still
retains the subform's focus.

As for your second suggestion, I had considered it, but
it is unworkable since I only disable ALL controls in the
extreme case; ordinarily only a subset (determined at
runtime) of the subform's controls are disabled.

Thanks anyway.

Pat
 
P

Patrick McGuire

I solved the problem by placing a new control on the
subform that could receive focus before anything is
enabled/disabled.

Thanks.

Pat
 

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