Link to home
Start Free TrialLog in
Avatar of smods
smods

asked on

How to display yes/no if value is -1 / 0

Hi,

Following on from my previous question:  

https://www.experts-exchange.com/questions/27047167/How-do-I-edit-this-code-to-enable-check-boxes.html

When the checkbox access stores a Yes as -1 or a No as 0

I need it to be displayed in a different form as either Yes or No

Is there some code to put on the checkboxes that would store it as Yes or No or do I use a query to convert the answer stored in the table to Yes or No?
Avatar of Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1)
Flag of United States of America image

if the field where the checkbox is bound is a YEsNo field, use a query to convert the values to Yes No.
select iif([chk1]=-1,"Yes","No") from tablename
Avatar of smods
smods

ASKER

Currently it's just a text field.  If I change them to a yes/no field then what would I put in the query?

Regards

Chris
see my second post.
Where you like to see Yes and No? Create Additional table with two columns and twi text fields:
-1 Yes
0  No
join your table with this one and display Yes and No everywhere
ASKER CERTIFIED SOLUTION
Avatar of Gustav Brock
Gustav Brock
Flag of Denmark image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of smods

ASKER

select iif([chk1]=-1,"Yes","No") from tablename

Hi capricorn1.

The field on the form is just stating #Name? when I do this?

Regards

Chris
post the real SQL statement that you are using.
there must be some check boxes that are null.
set the default value for all the check box fields to 0 (false)
Try with:

select iif([chk1]=-1,"Yes","No") as chkyesno from tablename

Then bind your textbox to [chkyesno]

Still, it is much easier and preferable just to set the Format property of the textbox.

/gustav

Avatar of smods

ASKER

Sorry Cactus! I totally didn't understand what you meant and I've just figured it out! Such an easy solution!

Thanks
No problem. You are welcome!

/gustav