Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Disabling subforms/focus problems

Status
Not open for further replies.

marshw

MIS
May 24, 2001
8
0
0
US
Here is my dilemna. Form A contains subform X as well as a few unbound text fields. Form B has a number of buttons and unbound text fields. Form A is the primary form and spawns form B through an on-click event in subform X. I would prefer to disable subform X after form B is loaded for various reasons:
Forms!FormA!SubformX.Enabled = False
I placed this line in several events involved with the loading/initialization of Form B. In every case, I am told that I cannot disable a control when it has the focus. I have tried several fixes:
a.) Switching the focus to form B before disabling subform X.
b.) Switching the focus to various other controls on form A before disabling subform X.
c.) Waiting until after form B has loaded (for instance, on the enter event of one of its text boxes) before disabling subform X, so that form B should have the focus.

Does anyone know how to snatch the focus away from subform X so that I can alter its Enable field?
 
I too have had problems like this. It v.annoying

Have you tried moving focus to a text box on FormA, then disabling subformX, then loading FormB? Sorry if this is what you mean in (b) above.

goodluck

 
Apparently, I hadn't tried that. It works. Thanks, ImpMan!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top