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

How to lookup the max value of the column

Status
Not open for further replies.

sabavno

Programmer
Jul 25, 2002
381
CA
Hi

I have a table called 'CONFIGURATION' that has a numeric 'ModelID' field.
How would I lookup the max value of that field from the vba code?

Thanks
 
Hi

You could use dMax() See help for syntax, or you could use a recordset based on select statement ordered by ModuleId Desc then read the first row.

Regards
Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
UK
kenneth.reay@talk21.com
 
Sabavno,
Give this a try

Function FindMaxValue()
Dim MaxValue As String
MaxValue = DLookup("Max([FieldName])", "TableName")
MsgBox MaxValue
End Function

RGB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top