Full Version: Is it Possible to enable/disable a control in the Control Source
UtterAccess Discussion Forums > Microsoft® Access > Access Forms
TomTessa
Problem: In the control source I would like to add the ability to enable/disable another control. crazy.gif

I need to limit the user to use one control of two available controls. The names of the two check boxes are: "chkGraduatedHighSchool" and "chkCompletedGED"

Right now this works for the control called "chkGraduatedHighSchool" It puts an "X" in a check box on my form.
=IIf([GraduatedHighSchool=-1,"X","")

What I would like to make it so the check box "chkGraduatedHighSchool" will disable or enable another control called "chkCompletedGED"
=IIf([GraduatedHighSchool]=-1,"X","",chkCompletedGED=false)

This does not work. I know how to do this in a "After Update" event, but I just wonder if I can do it in the control source?

Thanks!
Tom
ace
That wheel has already been invented.
It's called an Option Group.
ChrisO
G’day Tom.

=IIf([GraduatedHighSchool=-1,"X","")

That won’t even get past the editor…there is no closing square bracket after GraduatedHighSchool.

Could you please post a small demo of what you actually have?

Regards,
Chris.
TomTessa
What I really have is this:
I need to ask the user if the client has a GED or what was the last high school grade completed.

What I wanted to use was a combo box that has grades 9th thru 12th. If a grade was selected in the combo box then the GED check box would be disabled. When the GED box is checked I wanted to disable the combo box that has grades 9th thru 12th.

Using the option group as suggested (when GED in not selected) I can enable an extra text box to get the last grade completed. This will work fine but will add extra steps to do what I want. That might be my only choice.

If I could enable or disable it in the Control Source like I mentioned it would be really easy (IF possible). It is really cool that it is possible to do calculations in the control source. I just wondered if it could do what I am asking.

Sorry if I asked a dumb question :-(
TomTessa
Good catch Chris!

I mistyped my code.
I responded to the option box suggestion in a separate post.

Thanks! Tom
TomTessa
Ace, I forgot to hit REPLY in a previous post. This post will go to you so you can reply if you want.

Goodnight

QUOTE
What I really have is this:
I need to ask the user if the client has a GED or what was the last high school grade completed.

What I wanted to use was a combo box that has grades 9th thru 12th. If a grade was selected in the combo box then the GED check box would be disabled. When the GED box is checked I wanted to disable the combo box that has grades 9th thru 12th.

Using the option group as suggested (when GED in not selected) I can enable an extra text box to get the last grade completed. This will work fine but will add extra steps to do what I want. That might be my only choice.

If I could enable or disable it in the Control Source like I mentioned it would be really easy (IF possible). It is really cool that it is possible to do calculations in the control source. I just wondered if it could do what I am asking.

Sorry if I asked a dumb question :-(
ChrisO
So are you saying that: -

=IIf([GraduatedHighSchool]=-1,"X","")

works as the control source of a check box?

A check box is a Boolean but the above IIf function returns a string literal.
You appear to be assigning a string literal to a Boolean.

So again, could you please post a small demo of what you actually have?

Regards,
Chris.
ace
There are no dumb questions and I wasn't suggesting that yours
was. Personally I would just make GED a choice in the same combo
as grade completed.

I would suggest, as ChrisO did, that if you want something else
you may be best served by posting a demo.
TomTessa
I agree thanks for the help!
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.