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

Finding A Maximum Value

Status
Not open for further replies.

bigmerf

MIS
Oct 4, 2002
247
US
I have a Microsoft Access Report that lists 4 different fields in my Report Footer. Out of these 4 fields, I would like to find the MAXIMUM value or the highest value for these 4 fields.

Is there a function I can run within another field's control source like:

=MAX([FieldA],[FieldB],[FieldC],[FieldD])

I tried this and it doesn't seem to work at all.

Any help would be great!
 
If you include a reference to the Microsoft Excel x.x Object library, you can use functions from it:

Code:
Function getmax()

a = 10
b = 2
c = 15.1
d = 1

getmax = Excel.WorksheetFunction.Max(a, b, c, d)
End Function
 
Can you add this Function to the Control Source of a field on the Access Report, or does this have to be run using VB code?
 
You will need a function similar to the one I posted, then you can set the textbox to:

[tt]=GetMax(Field1,Field2,Field3)[/tt]

Or such like.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top