Full Version: disable checkboxes
UtterAccess Forums > Microsoft® Access > Access Forms
I am working in a form that has bound checkboxes. Those checkboxes are associated with month fields in a table, for ex. Apr30, Oct31. When one checkbox has been checked previously I want that box to appear grayed out
and the other to be accessible.
My code behind the form is a CASE statement. This is part of that statement.
Case "Semi-Annual"
If Me.AprCk = -1 Then ' Apr box is checked user cannot access
Me.Apr30.Visible = True
Me.AprCk.Enabled = False
Me.OctCk.Visible = True
Me.Oct31.Visible = True
Me.Apr30.Visible = True
Me.AprCk.Visible = True
Me.OctCk.Enabled = False
Me.Oct31.Visible = True
End If
What happens is that when semi-annual is chosen and I step thru it is working correctly but on the form both boxes are grayed out or only April appears even though there are no checkmarks in the table for that field.
Odon't know what to do next.
Is the default .Enabled property for AprCk in the form set to False? In your code above, if the Semi-Annual box is not check, you are not enabling the AprCk box. HTH.
In the properties box AprCk is set to Yes. Is this what you mean?
Yes, that's it. Can you post your db or give us a screenshot? I need to know more details. For example, what are these?
Semi-Annual" (textbox?)
Apr30 (textbox?)
AprCk (checkbox?)
OctCk (checkbox?)
Oct31 (textbox?)
Sure thing.
OK, from what I can see on your screen, let me suggest this:
implify your code for testing what you want.
Select FreqType
Case "Semi-Annual"
Me.AprCk.Enabled = Not AprCk
Me.OctCk.Enabled = Not OctCk
End Select
Try that and see if it helps figure out what's going on.
Yes. I saw that screenprint was not highly legible. I will try your suggestion.
This is a "lo-fi" version of UA. To view the full version with more information, formatting and images, please click here.