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!

IIf Function

Status
Not open for further replies.

djeverett01

Programmer
Aug 24, 2001
16
US
I am trying to do a report and I have a chk box names Negotiable and then I have the Minimum Salary for a job. If the chk box is checked and the minimum Salary is 0 then I want the report to say Negotiable otherwise I want the Salary to show up. I am currently using this code

=IIf(([Negotiable]<>0 And [Minimum Salary]=0),&quot;NEGOTIABLE&quot;,[Minimum Salary])

and everytime I run the report I get the message #Error. Am I not doing this right? Please help.
 
Textbox contents are STRINGS, so (at min) you need to compare the VALUE of the content of the textbox. It would APEAR that you will also need to check that there is SOMETHING in the textbox.

MichaelRed
m.red@att.net

There is never time to do it right but there is always time to do it over
 
Are both fields referenced in the expression (Negotiable & Minimum Salary) fields in the reports?

To find the problem, separate it: make a trial with only one part of the condition
=IIf (Negiotable<>0; &quot;NEGOTIABLE&quot;; [Minimum Salary])
then with the second
=IIf ([Minimum Salary]<>0; &quot;NEGOTIABLE&quot;; [Minimum Salary])

Further advice:
Avoid using variable names with separate words that lead you to use those boring brackets. Prefer underscoring, i.e. Minimum_Salary
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top