Convert Yes/No to Text

S

supersushi

Hello?

I'm going crazy. My company does not want to spend money on a programmer so
I am trying to figure this out on my own :)

Can anyone tell me:

I have a Yes/No field represented by a check box. That is fine.

When I create a report, I don't necessarily need to see the check box, but I
would like to see particular TEXT appear if the check box is checked (during
data entry). If the check box is not checked, I don't want to see anything
(i.e. just blank space).

Example:

Tracking Students that have received flu shots.
If the box is checked, it means "Yes," student has received flu shot.

I want to see ALL students listed on the report. BUT, if the box is checked
(i.e. the student has received flu shot) I want to see the message: Student
health file complete; may be admitted.

If the check box is NOT checked (i.e. student has not received flu shot), I
don't want any message to appear.

Please note: I do not even want to see a check box, whether it's checked or
not.

THANK YOU to anyone who can help me, I really appreciate it!

LIS
 
J

Jeff Boyce

I suspect you could do that using an IIF() statement in a query. Untested
statement follows:

IIf (Yes/No = Yes, "... may be admitted", "")

Regards

Jeff Boyce
Microsoft Access MVP
 
J

John W. Vinson

When I create a report, I don't necessarily need to see the check box, but I
would like to see particular TEXT appear if the check box is checked (during
data entry). If the check box is not checked, I don't want to see anything
(i.e. just blank space).

You can take advantage of the rather obscure "4 value format". A number field
- and yes, a checkbox IS a number field with -1 meaning True and 0 meaning
False - can have a Format property with four format values, for positive,
negative, zero and NULL respectively.

So you could put a Textbox on the report, bound to the yes/no field in the
table, with a format property

"";"Text if it is true";"";""

to display text if the field is TRUE and blanks otherwise.
 
S

supersushi

John,

Thank you so much! This worked like a CHARM! I'm really appreciative.

Lisa
 
S

supersushi

Jeff,

IIf I understood a wee bit more about Access, I'd have a clue where to even
PUT that statement :)

I will keep this advice for future reference once I become more advanced.
It's always good to know how to do something in more than one way.

Thank you!
Lisa
 
J

Jeff Boyce

When you get a chance, use Access HELP to check on the exact syntax.

You'd create a new query (in design view), add a new field, with something
like (again, untested):

NewField: {your IIF statement here}


Regards

Jeff Boyce
Microsoft Access MVP
 
S

supersushi

I have a follow up question.

Initially, I was using two yes/no fields and creating redundancy based on
whether or not the box was checked.

That said, I think I only need one field.

Originally, my question was how to make text appear if "True."

"";"Text if it is true";"";"" <--- worked like a charm.

BUTnow, how do I create a compound format so that I can show certain text if
TRUE, and alternative text if FALSE? based on one yes/no field.

Help?
 
J

Jeff Boyce

When you "bury" a follow on question down inside a thread like this, fewer
folks are likely to see it and offer their ideas. You will find that you
get a broader audience by posting this as a new item.

That said, please indicate WHERE you are trying to do this. In a report?
In a form? In a query?

Regards

Jeff Boyce
Microsoft Access MVP

--
Disclaimer: This author may have received products and services mentioned
in this post. Mention and/or description of a product or service herein
does not constitute endorsement thereof.

Any code or psuedocode included in this post is offered "as is", with no
guarantee as to suitability.

You can thank the FTC of the USA for making this disclaimer
possible/necessary.
 
J

John W. Vinson

Originally, my question was how to make text appear if "True."

"";"Text if it is true";"";"" <--- worked like a charm.

BUTnow, how do I create a compound format so that I can show certain text if
TRUE, and alternative text if FALSE? based on one yes/no field.

Since....

True is -1;
False is 0;
and the four-branch Format is +;-;0;NULL

"";"Text if true";"Text if false"; ""
 

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

Similar Threads


Top