Disable subform textboxes

G

Gabe

I'm not sure how to go about this, but I want to disbale some textboxes in a
subform based on whether the user selects a certain value from a combobox on
the parent form.

When the user selects "T" from the ApptType combobox on the parent
masterForm, then certain textboxes within the hoursSubform are disabled. Is
there anyway to do that?

Thanks,
~Gabe
 
M

Mark Andrews

In the after update event for the combobox just have some code so that if
they selected "T" then the subform control get disabled.
If (Me.ApptType = "T") then
Forms.mainform.subform.Form.control1.enabled = False
end if
http://www.allenbrowne.com/casu-04.html

Make sure you use the name of the subform (as shown in the properties when
clicking on the subform while looking at the mainform in design view).
Note: you can probably use shorter syntax to refer to the control on the
subform Me!frmsubform.Form.Control1.enabled = False or possibly
Me!frmsubform!Control1.Enabled = false. I've used the old syntax for so
long can't remember what all works.

HTH,
Mark
RPT Software
http://www.rptsoftware.com
 
G

Gabe

Nevermind, I figured it out! Just had to put this in both the parentform
OnCurrent property and the combobox AfterUpdate property:

Forms![ParentFrmName]![SubfrmName].Form![TextboxName1].SetFocus
Forms![ParentFrmName]![SubfrmName].Form![TextboxName2].Enabled =
(Me.ApptType <> "T")
Forms![ParentFrmName]![SubfrmName].Form![TextboxName3].Enabled =
(Me.ApptType <> "T")

Thanks,
~Gabe
 

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