checkbox to display text


S

So-Ange

Hello All,
I am working on a report that shows all projects from a table, instead
of showing the actual checkbox on the report I want it to display
"Active" if Yes, "Inactive" if No and "In Progress" if Null.
Here is my code:
=IIf(IsNull([Status],"In
Progress",IIf([Status]=Yes,"Active","Inactive"))
It only show the unchecked boxes for all records. HELP!
 
Ad

Advertisements

W

Wayne Morgan

It appears that you may be missing a parenthesis to close the IsNull()
function. Try:

=IIf(IsNull([Status]), "In Progress", IIf([Status], "Active", "Inactive"))

The field actually will contain True or False, not Yes or No. You can test
for True or False or just accept that the value is True or False, therefore
no test is needed (hence the missing =).

Another problem is that a Yes/No (i.e. True/False) field in a table is not a
triple state field, but the check box control on a form or report can be set
to triple state. The field in the table will be Null until you've set a
value, but it won't be set back to Null again, it will be either True or
False.
 
G

Guest

Wayne,
I have a similar problem. My Status field (text) is populated with an
option group. Available values of 1,2 or 3. 1=Active, 2=Inactive 3=N/A.
Is there a similar Iif statement that will display Active, Inactive or N/A
instead of 1,2 or 3?

Thanks Wayne



Wayne Morgan said:
It appears that you may be missing a parenthesis to close the IsNull()
function. Try:

=IIf(IsNull([Status]), "In Progress", IIf([Status], "Active", "Inactive"))

The field actually will contain True or False, not Yes or No. You can test
for True or False or just accept that the value is True or False, therefore
no test is needed (hence the missing =).

Another problem is that a Yes/No (i.e. True/False) field in a table is not a
triple state field, but the check box control on a form or report can be set
to triple state. The field in the table will be Null until you've set a
value, but it won't be set back to Null again, it will be either True or
False.

--
Wayne Morgan
MS Access MVP


So-Ange said:
Hello All,
I am working on a report that shows all projects from a table, instead
of showing the actual checkbox on the report I want it to display
"Active" if Yes, "Inactive" if No and "In Progress" if Null.
Here is my code:
=IIf(IsNull([Status],"In
Progress",IIf([Status]=Yes,"Active","Inactive"))
It only show the unchecked boxes for all records. HELP!
 
G

Guest

Please disregard..... found a reference to switch statments in my notes...
sorry to disturb you.

David said:
Wayne,
I have a similar problem. My Status field (text) is populated with an
option group. Available values of 1,2 or 3. 1=Active, 2=Inactive 3=N/A.
Is there a similar Iif statement that will display Active, Inactive or N/A
instead of 1,2 or 3?

Thanks Wayne



Wayne Morgan said:
It appears that you may be missing a parenthesis to close the IsNull()
function. Try:

=IIf(IsNull([Status]), "In Progress", IIf([Status], "Active", "Inactive"))

The field actually will contain True or False, not Yes or No. You can test
for True or False or just accept that the value is True or False, therefore
no test is needed (hence the missing =).

Another problem is that a Yes/No (i.e. True/False) field in a table is not a
triple state field, but the check box control on a form or report can be set
to triple state. The field in the table will be Null until you've set a
value, but it won't be set back to Null again, it will be either True or
False.

--
Wayne Morgan
MS Access MVP


So-Ange said:
Hello All,
I am working on a report that shows all projects from a table, instead
of showing the actual checkbox on the report I want it to display
"Active" if Yes, "Inactive" if No and "In Progress" if Null.
Here is my code:
=IIf(IsNull([Status],"In
Progress",IIf([Status]=Yes,"Active","Inactive"))
It only show the unchecked boxes for all records. HELP!
 
S

So-Ange

Wayne, I tried the =IIf(IsNull([Status]), "In Progress", IIf([Status],
"Active", "Inactive")) and it is still giving me blank checkboxes on
the report.
I am putting this IIf statement in the control source, should I be
putting somewhere else?
 
Ad

Advertisements

W

Wayne Morgan

It will give blank checkboxes on the report, this IIf will give text for a
textbox in lieu of using a checkbox.

Sometimes a report will get picky and to refer to a field in the report, the
field has to be bound to a control. To see if that's the problem, create a
checkbox on the report called chkStatus and bind it to the Status field.
Place the checkbox in the same report section as the textbox you want the
text in. Leave it visible for now (for testing purposes), but change its
Visible property to No when you're done. Now see what happens. Does the text
display in the textbox? If not, what does the checkbox look like? Is the
checkbox working as expected?

If the checkbox works correctly but the textbox still shows no text, change
the word Status in the statement to chkStatus so that it refers to the
control instead of the field.
 
Ad

Advertisements


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top