Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Displaying SQL y/n field as Yes or No in Access Forms

Status
Not open for further replies.

SylviaD

Technical User
Apr 6, 2006
7
GB
My Access form draws its data from an SQL database. Some of the fields are Y/N and are marked in SQL as bit fields.

What I need is some guidance on how to display these fields as either Yes or No on the Access form. I have tried =IIf([fieldname] = "0", "No", "Yes") but not successfully.

Is this possible and if so what code would I need and where would the code be entered.

Many thanks for your always excellent assistance.
 
Should work if you remove the "" text qualifiers from the 0 as this is not a string value.
 
If the field is a true bit field then you do't even need to compare it. Use the amended code below.


IIf([fieldname], "No", "Yes")

Ian Mayor (UK)
Program Error
Your lack of planning is not my emergency!
 
How are ya SylviaD . . .

Try this:
[ol][blue][li]In form design view, remove the checkbox.[/li]
[li]Insert an [purple]unbound textbox[/purple] in its place and set the following properties:
[ol a][li]Control Source: select the [purple]CheckboxName[/purple].[/li]
[li]Name: [purple]CheckboxName[/purple][/li]
[li]Format: [purple];"Yes";"No"[/purple][/li][/ol][/li][/blue][/ol]
Users now enter [blue]yes/no[/blue], however in VBA you always use, manipulate or detect with [blue]True/False[/blue] or [blue]-1/0[/blue] . . .

Calvin.gif
See Ya! . . . . . .

Be sure to see thread181-473997
Also faq181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top