If (checkbox) = true, the (textbox) = "Yes"

t3nchi

Registered User.
Local time
Today, 15:43
Joined
Sep 28, 2005
Messages
79
I want to add a textbox to my forms that either says "Yes" or "No" depending on what a non-visible checkbox is. My forms look funny with checkboxes all over the place (Yes or No fields). My reports would look better with "Yes" and "No" rather than checkboxes.

The question is, the control source of the new unbounded textboxes (or anything else for the matter), I don't know how to write the expression for it.

Can I just say...

if checkbox1=true then
txtbox1="Yes"

I understand how to write these in the VBA builder. But in the expression builder...
 
Try
if me.checkbox1=true then
me.txtbox1="Yes"
else
me.txtbox1="No"
end if
end sub

Would ask you to try this and let me know if it is still not working.

Alastair
 
You need to use the Immediate IF in the ControlSource of the TextBox:
IIF(YourCheckBox = True, "Yes","No")
 
Ok, the IIF worked great. Thanks RG.

And thanks Alistair, that would probably be what I would've done if in VBA app. But this is different (control source deal).
 
=IIf([A1]=0,"No","Yes")

I get an error message when I display the report. What am I doing wroing?

A1 is a option group box. With a 0 for the value of Label "No" and 1 for label "yes".
 
The default usually starts with 1 rather than 0 unless you changed it. Try this:
=IIf([A1]=1,"Yes","No")
By the way, you didn't mention *what* error you were getting. ;)
 
You don't need any Iif statement, add an unbound textbox, set the control source to that of your checkbox field, set the display format to Yes/No
 

Users who are viewing this thread

Back
Top Bottom