Dlookup minimum value

L

Luis

Hello.

I'm trying to use Dlookup to get the minimum date from a table.

I was trying to do the following command:

mDate=Dlookup(min("dateField"),"tblName")

Somehow the code points an error on"Min", saying that "Sub or Function not
defined".

Is it possible what i'm doing? Is there any other way instead of looping
through all the records?

Thanks.
Luis
 
J

JimBurke via AccessMonster.com

The first value is supposed to be simply a field name - you can't use an
operation on the field like that. You want to use the DMin function:

mDate=DMin("dateField","tblName")
 
P

Paolo

Hi Luis,
to achieve your goal use the dmin function so

mDate=Dmin("dateField","tblName")

HTH Paolo
 
L

Luis

Perfect!
Thank you all.
Luis


JimBurke via AccessMonster.com said:
The first value is supposed to be simply a field name - you can't use an
operation on the field like that. You want to use the DMin function:

mDate=DMin("dateField","tblName")


--
Jim Burke



.
 
Top