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

IF... THEN... ELSE in a Report

Status
Not open for further replies.

Rickalty

Technical User
Jun 29, 2001
42
US
Hello, everyone. I'm trying to write a report in Microsoft Access 97, and can't get the right result.

I want a textbox field to display "Y" or "N" depending on whether a job is within tolerance or not. What I have written in the Control Source is :-

=if((([VoyRat]-[AvgRat])>0.003), "N", "Y")

I picked the field names from the list in the event builder, so I know it's not just a spelling error.

When I preview the report though, I get an "Enter Parameter Value" dialog box asking for a value for 'if'! Whatever I enter, the report shows #NAME. What am I doing wrong?

Thanks for your help,
Richard
 
Hi Richard!

You need to use IIf:

=IIf(([VoyRat]-[AvgRat])>0.003, "N", "Y")

This assumes that VoyRat and AveRat are part of the recordsource of the report.

hth
Jeff Bridgham
bridgham@purdue.edu
 
Jeff,

You are a gentleman and a scholar.... thanks very much, that works fine.

Richard
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top