B Brendan Reynolds Apr 1, 2009 #2 alvin Kuiper said: Hi How can i use Max(Field) in vba programmering Regards alvin Click to expand... 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")
alvin Kuiper said: Hi How can i use Max(Field) in vba programmering Regards alvin Click to expand... 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")
T Tom van Stiphout Apr 1, 2009 #3 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
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