DLast

  • Thread starter Thread starter Vinnie via AccessMonster.com
  • Start date Start date
V

Vinnie via AccessMonster.com

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!
 
Use the name of the query as the second argument for the function, not the
name of the tblRateHistory table.
 
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\# ))
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Back
Top