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

Doulbe IIF statement possibility?

Status
Not open for further replies.
Oct 8, 2003
15
US
I've built a timesheet/payroll database and I have one part left to complete in it.

What I have (a sample):

ProjID RegHours OTHours RHours
D04Beer 3.5 0 3.5
M04Rats 4 0 4
Pfront 6.5 0 6
Pbox 4 0 4
Pbox 7 0 6.5
Pcon 12 0 11.5*

*Should be 11, not 11.5 which is my problem

The idea: where a ProjID equals Pbox, Pcon, or Pfront, deduct a half an hour for more than 6 hours worked and a full hour if more than 10 hours are worked. (RHours are the result of the deduction and OTHours never exceed 6.)

What I've tried in a query field:
RHours: IIf([RegHours]>6 And ([ProjID]="Pbox" Or [ProjID]="Pcon" Or [ProjID]="Pfront") Or ([RegHours]>10 And ([ProjID]="Pbox" Or [ProjID]="Pcon" Or [ProjID]="Pfront")),([RegHours]-0.5),[RegHours])

This obviously only subtracts a half an hour if 6 hours or 10 hours has been reached.

Is it possible/what would I have to do to get this to work the way I need it to?

Thank you in advance!!

Val
 
RHours: IIF([RegHours]>6 And ([ProjID]="Pbox" Or [ProjID]="Pcon" Or [ProjID]="Pfont"), IIF([RegHours]>10,[ RegHours]-1.0 ,[RegHours]-0.5),[RegHours])

First checks if over 6 hours and any of the selections...if not, = to reghours. next check if over 10 hours, = reghours - 1 else = reg hours - 0.5

****************************
Computers are possibly the most un-intelligent things ever invented, yet we let them control the world. Possibly a reflection of our own stupidity.

Robert L. Johnson III
MCSA, CNA, Net+, A+
w: rljohnso@stewart.com
h: wildmage@tampabay.rr.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top