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

IIf Statements in Reports

Status
Not open for further replies.

ScoobyDew

IS-IT--Management
Aug 16, 2002
4
0
0
US
I created an Attendance report that sorts by individual employees. In the footer section for each employee I used the COUNT function to tally the number of attendance occurences that each employee has. I need to be able to have a disciplinary step printed out in the footer for each employee that shows us the stage that the particular employee is in. For example, Employee A has incurred 3 tardies. I need the words "Verbal Warning" to appear on the report. First of all, can I use an IIF statement on a report to calculate something? My IIF statement is written as follows: IIF COUNT[JOBS]= 3 THEN "VERBAL WARNING". I keep getting syntax and missing operator errors. How can I make this work. Should this be done in the query that the report runs from? If so, how?

Please Help!!!
Thank you
 
IIf is a function that takes three parameters:

IIf(Condition, Do this, else do this)

So a more valid syntax would be

IIf(COUNT[JOBS]= 3, "VERBAL WARNING", "Something else"). Have fun! :eek:)

Alex Middleton
 
To add upon the previous help...you may want to nest the IIF statement as well. To use the the example the previous user sent in....

IIf(COUNT[JOBS]= 3, "VERBAL WARNING",IIF(COUNT[JOBS]=6,"SUSPENDED",""))

This states that if the count=3 then they get a verbal warning, and if the count=6 they are suspended...if it is neither, then just leave it blank.....

Hope this helps....

Nick
 
Alex & Nick,
Thank you very much for your replies. The IIF statement still doesn't run when I write this in the report. Should it be done in a query. If so, how?

Thanks
 
I need to see the report and what you are typing in the control box...make sure you use the ( ) and also try putting an = before the statement...otherwise, like I said I need to see it....

How about e-mailing me a screen shot of the statement...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top