Access Report expression

M

Michele

I need help in looking 20 fields and if the answer equals (whatever), look in
anothers fields and add them together.
Such as:
If (field) or (field) is equal to 101, then look in (these other fields) and
add them together.
 
O

Ofer

Try using iif in the control source of the field where you want to display
the result

iif(condition,then,else)

IIf([Field1]=101 or [Field2] = 101, [Field3] + [Field4], [Field5] + [Field6])
 
D

Duane Hookom

Sounds like a normalization mess but I could be wrong. Can you share more
specific information?
 
M

Michele

Hi Duane, It's like what Ofer wrote, however it still didn't give me my right
total.
I have hrs in on field and a work code for those hours in another field.
What I
need to do is find all the codes that = 101, and add the hours that match
this work code. I have 50 work code #'s 101 thru 125 and 501 - 525. I have
4 different work codes fields & 4 different fields for hrs for each day.
Does this help?
 
M

Michele

Michele said:
Hi Duane, It's like what Ofer wrote, however it still didn't give me my right
total.
I have hrs in on field and a work code for those hours in another field.
What I
need to do is find all the codes that = 101, and add the hours that match
this work code. I have 50 work code #'s 101 thru 125 and 501 - 525. I have
4 different work codes fields & 4 different fields for hrs for each day.
Does this help?
 
M

Michele

I pasted my formula for you to review, and it adds all hrs even if it's not
coded
101.

=IIf([MonLC]=101 Or [TuesLC]=101 Or [WedLC]=101 Or [ThurLC]=101 Or
[Mon1LC]=101 Or [Mon2LC]=101 Or [Mon3LC]=101 Or [Tues1LC]=101 Or
[Tues2LC]=101 Or [Tues3LC]=101 Or [Wed1LC]=101 Or [Wed2LC]=101 Or
[Wed3LC]=101 Or [Thur1LC]+101 Or [Thur2LC]=101 Or
[Thur3LC]=101,[Mon]+[Tues]+[Wed]+[Thur]+[Mon1]+[Mon2]+[Mon3]+[Tues1]+[Tues2]+[Tues3]+[Wed1]+[Wed2]+[Wed3]+[Thur1]+[Thur2]+[Thur3])
 
Top