Disable CheckBox

BBBryan

Registered User.
Local time
Today, 02:02
Joined
Nov 13, 2010
Messages
122
Hi,
Does anyone know how to.

In ms access 2003
I have a form in DataSht View
I have a text box (DisableControl) with either a Blank or "disable" in it.
I have a checkbox (Yes)
When the form loads or opens I want to disable the check boxes (Yes) that I have "Disable" in the DisableControl field.

I was trying this but doesn't work. It makes ALL of the checkboxes Disabled

Private Sub Form_Load()
If Me.DisableControl = "Disable" Then
Me.Yes.Enabled = False

Else Me.DisableControl = " " Then
Me.Yes.Enabled = True
End If
End Sub

I tried a couple of different ways but can't make it work.


Thanks BBryan
 
In datasheet or continuous view you would need to use Conditional Formatting.
 
how do you bring up the conditional formatting box on a check box?
 
BBryan,
You can select that the checkbox is either enabled or disabled when the form opens. You might also want to make a separate If statement for the blank and disabled condition rather that using else just to see if something else is creeping into the game.

Richard McCabe
 
In datasheet or continuous view you would need to use Conditional Formatting.
Actually, that's not true. For any Formatting except Locking/Disabling a Control it is true. But using Locking/Disabling can be done, in Datasheet/Continuous View Forms, because using these two Properties, together, doesn't result in any change in the appearance of the Controls. You can use code like this:
Code:
Private Sub Form_Current()
 If Me.DisableControl = "Disable" Then
   Me.Yes.Enabled = False
   Me.Yes.Locked= True
 Else 
   Me.Yes.Enabled = True
   Me.Yes.Locked= False
 End If
End Sub

Although it's not needed here, since a simple Else is needed, the OP should note that if basing an action on a Control being empty, instead of using

Me.DisableControl = " "

something like this should be used

Nz(Me.DisableControl, "") = ""

Also, Yes is a Reserved Word, in Access, and needs to be changed to something else!

Linq :)>
 
Last edited:

Users who are viewing this thread

Back
Top Bottom