DMax and DateDiff func

AlLeX_Brd

Registered User.
Local time
Today, 09:23
Joined
Jul 4, 2005
Messages
19
HI All,

I'm using
Between DMax("DateFieldName","TableName")-10 And DMax("DateFieldName","TableName") expression

in query to find time interval 10 days prior the last record puting this into Date field in my query Criteria. It's working fine.
But I want to find time interval a Month and an Year prior the last record.
I'm thinking to use DateDiff func to calculate properly intervals.

Between DMax("DateFieladName","TableName")-DateDiff ("m",1-2-100,1-1-100) And DMax("DateFieldName","TableName") --> for a month

That function also work but I'm not sure if it calculate correct result

Any better ideas? Thanks!

:cool:
 
Last edited:
Take a look at the DateSerial function.
 
AlLeX_Brd said:
HI All,

I'm using
Between DMax("DateFieldName","TableName")-10 And DMax("DateFieldName","TableName") expression

in query to find time interval 10 days prior the last record puting this into Date field in my query Criteria. It's working fine.
But I want to find time interval a Month and an Year prior the last record.
I'm thinking to use DateDiff func to calculate properly intervals.

Between DMax("DateFieladName","TableName")-DateDiff ("m",1-2-100,1-1-100) And DMax("DateFieldName","TableName") --> for a month

That function also work but I'm not sure if it calculate correct result

Any better ideas? Thanks!

:cool:

What you need is something like this:

BETWEEN DateAdd("m",-1, DMax("DateFieldName","TableName")) AND DMax("DateFieldName","TableName")

That will give records between the last Date and one month prior.
 

Users who are viewing this thread

Back
Top Bottom