Hi,
Fairly basic question I'd say, but I'm stuck!
I'm running a DLast function in a query.
In the criteria section, I want the date to be less than or equal to a date
in another table, is it possible to reference another table in the function?
I've tried the following:
DLast("[Comm]","tblRateHistory","[Date]<[tblData]![Date Entered]"), in the
[Comm] field of the query.
[Comm] and [Date] are taken from the tblRateHistory table, and the [Date
Entered] field is taken from the tblData table.
The two tables are included in the query.
Thanks!
Ken Snell (MVP) - 30 May 2006 13:14 GMT
Use the name of the query as the second argument for the function, not the
name of the tblRateHistory table.

Signature
Ken Snell
<MS ACCESS MVP>
> Hi,
>
[quoted text clipped - 18 lines]
>
> Thanks!
John Spencer - 30 May 2006 13:15 GMT
I suspect that you don't want to use the DLast function. It returns what
the human can think of as a more or less random value for the specified
field from the matching records. It is the last record accessed - not the
latest record entered. You may really want to use DMax or DMin. However,
try
DLast("[Comm]","tblRateHistory","[Date]<#" & [tblData]![Date Entered] & "#")
If your dates are not in US format of MM/DD/YYYY you may need to format
tblData!DateEntered.
DLast("[Comm]","tblRateHistory","[Date]<" & Format([tblData]![Date
Entered],"\#yyyy\-mm\-dd\# ))
> Hi,
>
[quoted text clipped - 18 lines]
>
> Thanks!