Where clause using max of

WineSnob

Not Bright but TENACIOUS
Local time
Today, 08:55
Joined
Aug 9, 2010
Messages
211
I am trying to open a form using the where clause to max of a table field.
I cannot get the syntax correct.

Code:
 DoCmd.OpenForm "frmInput", , , Max(tblClients.ClientID) AS MaxOfClientID FROM tblClients
 
Something like

"ClientID = " DMax("ClientID","tblClients")
 
MAX is a SQL function, you can't use SQL right there. Instead you should use the DMAX function (http://www.techonthenet.com/access/functions/domain/dmax.php).

However, that's just going to return a value, you need to set a value from the form equal to it to use as criteria. What field in the form do you want to equal the value?
 

Users who are viewing this thread

Back
Top Bottom