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

Access Report

Status
Not open for further replies.

demon147

Technical User
Jun 29, 2001
30
CA
I have a report and want to make some calculations using the fields but one calculation I have to make requires choosing only the highest value out of three different fields and then adding that amount with five other fields.

Help appreciated.

George
 
George:

If I understand the question, what you will need to do is put a conditional statement in the On_Format event of the section where the fields appear (Detail?).

Here's how I would do it.

Dim intHigh as Integer

intHigh = FirstValue

If SecondValue > intHigh Then
intHigh = SecondValue
End If

If ThirdValue > intHigh Then
intHigh = ThirdValue
End If

SumField = intHigh + Field1 . . . + Field5

Let me know if you have any questions or problems with this.
Larry De Laruelle
larry1de@yahoo.com

 
You could also do nested iif statements in the control source of an unbound textbox:

=IIf(Val1 > Val2, IIf(Val1 > Val3, Val1 + Nbr1 + Nbr2 + Nbr3 + Nbr4, IIf(Val2 > Val3, Val2 + Nbr1 + Nbr2 + Nbr3 + Nbr4, Val3 + Nbr1 + Nbr2 + Nbr3 + Nbr4)))

HTH Joe Miller
joe.miller@flotech.net
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top