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 Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Disable all subform controls (Remove focus from all controls)

Status
Not open for further replies.

DeanWilliams

Programmer
Feb 26, 2003
236
GB
Hi,

This seems so easy but I can't figure it out.

I have a subform that needs to have all its controls disabled if the underlying record is read-only. I have a Yes/No flag field that indicates this. The main form has a combobox that changes the record displayed in the non-continuous subform.

The problem is this: when the record in the subform changes from an editable record to a read-only one (via combobox), I cannot disable all the controls because at least one of them will have the focus.

The only way I have managed to remove the focus from every control, is to set the sourceobject for the subform control to nothing, then relaod the subform and disable all controls.

This is very messy though and takes too long to update.

Any help with this would be appreciated.

Dean :)
 
This is probably a "cheaters" way to do this, but I have worked around this problem by creating a very small textbox on subforms that is transparent to the user. I set the focus to that text box, then disable the other controls. To the user it just looks like a blinking cursor in a random place on the form.
HTH
JeanS
 
Oh yeah I used to do that a while ago. Forgot about that. Is probably the easiest thing to do, but I was hoping there was another way.
 
If you can get focus to a control on the main form, you should be then able to Disable the entire subform by setting the Enabled property of the sub form Container on the main form to False. I think this should work but it has been a while since I had to do it.

Good LucK!


Have a great day!

j2consulting@yahoo.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top