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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Change Yes/No field to display text value

Status
Not open for further replies.

GWINTO

IS-IT--Management
Nov 26, 2001
188
GB
I am writing a query in Access that is required to export to excel, one of the fields is presently a yes/no field but needs to be exported as a text value (dependant on the condition).

I have tried: IIf([YesNoField]=True,"Text1","Text2")'

This doesn't work, when the query is run I am presented with a field of greyed out checkboxes.
 
Should have said, I've tried this and it gives the same result
 
Try..

IIf([YesNoField],"True Text","False Text")


There are two ways to write error-free programs; only the third one works.
 
GWINTO,

Your original statement will work in your query, but you have to use it in an expression field, not with the bound Yes/No field. Something like this:
Code:
txtYesNo: IIf([YesNoField]=True,"Text1","Text2")
 
The problem turned out to be the name I had given the expression field, still havn't figured out why, but after changing it my original syntax worked - thanks guys
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top