set label value based checkbox is ticked

psuplat

Registered User.
Local time
Today, 14:42
Joined
Mar 18, 2009
Messages
35
Hi.

On the report i have a checkbox bounded to table field named "disc", the checkbox is hidden. Also I have a label called "lblDisc", also hidden by default.

What I want is when the box is ticked, I want the lblDisc visibility value set to true.
Or, other way of doing it, lblDisc is visible by default but forecolor is set to white. When checkbox is ticked the forecolor turns, let say red.

I tried codeing using if else elseif, end placing it in form detail OnFormat and OnPrint events but to no avail. Don't kow what I'm missing.

Any help hugely appreciated
 
Just use Conditional Formatting.

Select the label and then go to FORMAT > Conditional Formatting (in 2007 and above you right click on the label and select Conditional Formatting from the pop up menu).

In the Conditional Formatting you select EXPRESSION IS (instead of Value IS) and then you can set the name of the checkbox using square brackets:

[MyCheckBoxNameHere] = True

and then set the format you want when it is true.

You can then add another condition to it and select the format when

[MyCheckBoxNameHere] = False
 
I'm using access 2003, and looks like i cannot apply conditional formating to labels. If i select label and go to menu format, that function is disabled :(
 
I'm using access 2003, and looks like i cannot apply conditional formating to labels. If i select label and go to menu format, that function is disabled :(
Just change it to a text box and then set the special effect to FLAT and border to TRANSPARENT and the BACKSTYLE to NORMAL and set the backcolor to the same as the form.

Then you can use that.
 
Tried it, but still doesn't work.

But I managet to find a solution. It was actually simpler than i though it would be.

I just add the following code in the reports detail OnFormat event:

If Me.checkNIU= False Then
Me.lblNIU.Visible = False
End If

Anyway thanks, willingness to help always appreciated :)
 

Users who are viewing this thread

Back
Top Bottom