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!

How do you substitute a different field for another on a report? 1

Status
Not open for further replies.

shanl

Technical User
Apr 2, 2007
41
US
I'm new to Access so bear with me if this is basic. I've created a form in Access that allows users to select employees from the appropriate dept to be printed on a payroll report. At the point in time I open my report I have all the data to print all the employees selected in that department's information.

Due to the way our shifts work, some times people work more than 80 hrs and sometimes its less so I've been asked to make all full time person set at 80 hrs.

For Part time people however I need to calculate their exact hrs worked.

At the time that I"m ready to print a line for a full time person or a part time person I want to print them under the same "Hrs worked" heading but print the correct full time or part time hours based on who I'm reporting on. I haven't figured out how to add "If" type logic in the REPORT to allow me to check if the Part time total has a balance > 0 so I'll know which hr calculation to use.

Here's how I'm calculating the full time hrs. (I need to deduct all their Leave and vacation.)

=80-[Holsum]-[CSum]-[SickSum]-[VacSum]-[pHSum]-[WCSum]-[FuneralSum]-[MilSum]-[LWOPSum]-[FMLASum]-[Jurysum]

Here's my Part time calc and will need to add similar deductions that I did for full time for Leave and vacation but for this question I'll just leave it as is.

=Sum([Parttimehrs]/60)

 
Hi shanl,

I think that all you really need is an explanation of how to use an IF construct - no?

Code:
=iif(a>0,b+c+d+e+f,b+c+d+e+g)

The above is actually saying: IF a > 0 then place the b+c+d+e+F calculation in this field ELSE place the b+c+d+e+G calculation in this field.

The first comma following 'a>0' is really a THEN statement and the second comma is really an ELSE statement.

Does this help you?

Regards,

Darrylle

Never argue with an idiot, he'll bring you down to his level - then beat you with experience.
 
Darrylle,
You're a gem. I appreciate the explanation and when I plugged it in, it worked great.
Shan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top