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

Unbound Field to Display Largest Value 1

Status
Not open for further replies.

number2

Technical User
Oct 25, 2001
284
US
I have an unbound field which I want to display the largest value found in several other unbound fields. ie.
FieldD = which value is larger, FeildA, FieldB or FieldC

Any ideas?
 
Try this:

Code:
=Switch([Field1]>[Field2] and [Field1]>[Field3],[Field1], [Field2]>[Field1] and [Field2]>[Field3],[Field2], [Field3]>[Field1] and [Field3]>[Field1],[Field3])

this expression in the Control Source should do it.

Bob Scriver
[blue]Want the best answers? See FAQ181-2886[/blue]


 
There is only one problem with this solution: If all values are equal then no value is selected as the highest value. Is there a way to select one of the equal values?
 
Sure give this a try:

Code:
=Switch([Field1]>[Field2] and [Field1]>[Field3],[Field1], [Field2]>[Field1] and [Field2]>[Field3],[Field2], [Field3]>[Field1] and [Field3]>[Field1],[Field3], True, [Field1])

You see if none of the first three expressions are valid then they must all be the same so the fourth expression(True), returns the value of [Field1].

Let me know if this is what you want.

Bob Scriver
[blue]Want the best answers? See FAQ181-2886[/blue]


 
Thanks! Once again; it works perfectly!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top