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

Please help with setting format criteria 2

Status
Not open for further replies.

HockeyFan

MIS
Jun 21, 2005
138
US
In a report, I have a subform. In that subform are 2 fields. When I display the report, I need to change the display contents to the word 'yes' if a particular data value is present. Otherwise I need to display 'no'.

In other words, if the data would normally display the word 'stralias' when previewing the report, I need it to say the word 'yes' instead. I tried using the iif, but I guess i'm not putting it in the right place or something. Please help.
 
Next time please provide the results of your "tried using the IIF". You can use IIf() with syntax like:

=IIf([somefield]="Some Value","Yes","No")

This can also be done using the Format Property and a control source of only:
= [somefield]="Some Value"

Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
Thanks for the reply dhookom, however the statement =IIf([somefield]="Some Value","Yes","No") is exactly what I typed in. Perhaps i'm not placing it in the right place. I tried the control source for the text box in my subreport, I also tried placing that statement in the OnFormat of the detail section of the report. Any other suggestions? It seems that regardless of where I type it, then it has no bearing on the results. My results still display the original word.

 
I am having trouble seeing your IIf() statement. If you used
=IIf([somefield]="Some Value","Yes","No")
then I can see why it didn't work.

You must make sure the name of the control is not the name of a field in your report's record source.

Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
Thank You, Thank You, Thank You. The reason was because I did have the field name the same as the dataname. I fixed this and it works great!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top