Criteria help

P

Peggy

I know what this in the criteria returns.

DMax("[EventDate]","Detail"

What can I put in the CustomerID criteria to give me the
above for each CustomerID?

???("[CustomerID]","Customers")
 
S

Steve Schapel

Peggy,

I think you are going to need to give some more information if you want
a useful answer. What tables and fields are you working with here, and
what are you trying to achieve? Posting the SQL view of the query is
often helpful, as is giving examples.
 
J

JohnFol

You could do
Dim MyMaxDate as Date
MyMaxDate = DMax("[EventDate]","Detail"
msgbox DLookup ("[CustomerID]","Customers","[EventDate] = '" &
Format$(MyMaxDate, "ddmmmyyyy") & "'")
 
J

John Vinson

I know what this in the criteria returns.

DMax("[EventDate]","Detail"

What can I put in the CustomerID criteria to give me the
above for each CustomerID?

???("[CustomerID]","Customers")

Not knowing anything about the structure of your tables, this is a WAG
but...

a criterion on EventDate of

=DMax("[EventDate]", "[Detail]", "[CustomerID] = " & [CustomerID])

may work (assumptions: the Detail table is the table you're searching;
it has a numeric CustomerID field, and you want the most recent event
for each customer).
 
Top