Date Query (last week, last 2 weeks, last month, last year, all)

danysfx

New member
Local time
Today, 00:39
Joined
May 31, 2007
Messages
4
Hi

Would be great if I could get some help on this:

I have big table that gets updated almost every day with new data. There is a date column. I have a Form where I can enter queries. I need to add a panel where I can spcify if the query should involve the data should involve the date from last week only, from the last 2 weeks, from the last month or if the query should involve the overall data.:confused:

It somhow need to be check what the date is today and then caclulate back.

Any help on this would be much appreciated.:D

Thanks
Daniel
 
for this you could use the dateadd function
last week would be
dateadd("d",-7,date())
2 weeks
dateadd("d",-14,date()) etc..
month
dateadd("m",-1,date())
 
Hi, thanks for that input

I am still not sure how to implement that into my form. What kind of list or box should I use, so that I can click on "last week" or "last month".

Thanks for further help
Daniel
 
for this you could use the dateadd function
last week would be
dateadd("d",-7,date())
2 weeks
dateadd("d",-14,date()) etc..
month
dateadd("m",-1,date())

It seems that

dateadd("d",-7,date())

is not giving the whole last week, it is giving the day that is 7 days back, e.g. today it is giving the date from 7 days ago, from the 24th only.

I need the whole last week, not only 1 day.

How do I have to use Daterange then?

Thanks
Daniel
 
oh i misread what u were asking. i thought u were asking for the date of today for last week. ie today is thursday u wanted thursdays date. my next point was to tell u to use the BETWEEN function, but keiths DateRange will probably do you better. try searching the forum on it!
 

Users who are viewing this thread

Back
Top Bottom