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!

Problem with using IIf statement in a report control

Status
Not open for further replies.

HowardB

Technical User
Aug 24, 2002
18
GB
I am trying to use an IIf statement in a textbox control called PatSex on a report. The textbox is bound to a field called PatSex on an underlying table. In report design mode I entered the following statement into the PatSex textbox control source property:

=IIf([PatSex]="M","Male","Female")

The property entry is accepted with no errors but when I run the report I get a #Error message displaying in the Sex field.

I did have this field validated on the table to be of length 1 Character and only "M" or "F" as valid entries but even when I remove all the validation and increase the allowable length to 6 characters I still get the same runtime error on the report.

Can anyone tell me where my thinking is going astray or why this code is not working?

Thanks in anticipation HowardB
 
Hi

rename the textbox control as (say) txtPatSex and leave the =IIf([PatSex]="M","Male","Female")as it is.
Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
UK
 
Hi Ken,

That fixed the problems, I guess I confused the poor thing, many thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top