Using Max

  • Thread starter Thread starter alvin Kuiper
  • Start date Start date
alvin Kuiper said:
Hi

How can i use Max(Field) in vba programmering

Regards

alvin

You can use the DMax() function ...

Msgbox DMax("YourField", "YourTable")

.... or you can use Max() in a SQL statement, for example by opening a
recordset ...

Dim db As DAO.Database
Dim rst As DAO.Recordset

Set db = CurrentDb
Set rst = db.OpenRecordset("SELECT Max(YourField) AS MaxValue FROM
YourTable")
MsgBox rst.Fields("MaxValue")
 
On Wed, 1 Apr 2009 05:50:01 -0700, alvin Kuiper

(if I understand you correctly)
Check the help file for Max, DMax, and Totals Query.

-Tom.
Microsoft Access MVP
 
Back
Top