Enabling a disabled checkbox under certain conditions

kyuball

Registered User.
Local time
Yesterday, 19:44
Joined
Jul 6, 2009
Messages
66
I was wondering if this was possible:

I am using a form with checkboxes that also populates a table with several checkboxes to give profile information on mental health clients. All of the fields are independent of the others (e.g. "physical disabilities" can be checked alongside "domestic violence issues" etc.) with the exception of one. The last checkbox is called "Other" and there is a memo field where they can specify what that other is. However, one of the most common "other" is general health concerns (I cannot add general health concerns as a check box as the content of the data we are keeping track of is determined by an outside funding agency), and we wanted to keep track of how many of the "other"s are just health issues. So, I added a checkbox field called "otherishealth" at the end of the client profile table and disabled the control for that field without locking it on the form. What I would want to do is have the control for "otherishealth" to be enabled only when "other" has been checked off.

My assumption is that the code of it would start like this:

Private Sub other_AfterUpdate()
If IsTrue(other) Then
me.otherishealth = ??????

This form is set to not save the record until a save button has been clicked (a little trick that I got from these very same forums), so I can't set up a separate table for the "otherishealth" field and have a separate form pop up for that condition.

Any help?
 
I would worry less about enabling and disabling the control and be more concerned about the data. Set and clear the data based on the users choices if there is a dependency like you describe. And this is pretty simple for boolean fields since they are already either true of false...
Does the logic go like this? ...
Code:
Other1   -> Other2
To True  -> No Change
To False -> To False

Other2   -> Other1
To True  -> To True
To False -> No Change

if so the code would look like
Code:
private sub Other1_Click()
[COLOR="Green"]  'turning other1 off turns off other2[/COLOR]
  if not me.other1 then me.other2 = false
end sub

private sub Other2_Click()
[COLOR="Green"]  'turning other2 on turns on other 1[/COLOR]
  if me.other2 then me.other1 = true
end sub
And then just allow the user to discover this behaviour, which they cannot override.
 
I wanted to thank everyone who helped me out with this as it is now working great! I also wanted to thank the responders to the double post that I put in the forms section....

And my apologies for being an idiot and double-posting.... :-(
 
It's cool. Thanks for posting back. I just felt a bit cheated after spending time on your post and then finding you'd received a reponse to the other one too.
Cheers kyu,
 

Users who are viewing this thread

Back
Top Bottom