Query Date criteria

  • Thread starter Thread starter Jasper Recto
  • Start date Start date
J

Jasper Recto

I have a query that has a date criteria that is in a range. For example it
runs from 1/01/08 to 03/31/08.

Is it possible to change the criteria so it always run the past 3 months
from the date is was run. So for example, if I ran it today (07/18/08) the
criteria field would select the last 3 months from today, so 04/18/08 to
07/18/08.

Can you do that in the query?


OR
is it possilbe to have it prompt the user for which quarter of the year to
run?


Thanks,
Jasper
 
On Fri, 18 Jul 2008 08:49:16 -0400, "Jasper Recto"

Yes: use a where clause like this:
where YourDateField between DateAdd('m',-3,Date()) and Date()

-Tom.
Microsoft Access MVP
 
I have a query that has a date criteria that is in a range.  For example it
runs from 1/01/08 to  03/31/08.

Is it possible to change the criteria so it always run the past 3 months
from the date is was run.  So for example, if I ran it today (07/18/08)the
criteria field would select the last 3 months from today, so 04/18/08 to
07/18/08.

Can you do that in the query?

OR
is it possilbe to have it prompt the user for which quarter of the year to
run?

Thanks,
Jasper

SELECT Contacts.EMailAddress, Contacts.InterviewDate
FROM Contacts
WHERE (((Contacts.InterviewDate) Between DateAdd("m",-3,Date()) And
Date()));
 
Works Great, Thanks!

Although, one more question.

If I wanted to prompt the user for the beginning date and the end date, how
would I do that?


Thanks,
Jasper
 
On Fri, 18 Jul 2008 09:18:21 -0400, "Jasper Recto"

where YourDateField between [Give start date:] and [Give end date:]

Or you create a pretty form, and have the query "look back" on it:
where YourDateField between Forms!SomeForm!SomeStartDate and
Forms!SomeForm!SomeEndDate

-Tom.
Microsoft Access MVP
 
THANKS!!!!


Tom van Stiphout said:
On Fri, 18 Jul 2008 09:18:21 -0400, "Jasper Recto"

where YourDateField between [Give start date:] and [Give end date:]

Or you create a pretty form, and have the query "look back" on it:
where YourDateField between Forms!SomeForm!SomeStartDate and
Forms!SomeForm!SomeEndDate

-Tom.
Microsoft Access MVP


Works Great, Thanks!

Although, one more question.

If I wanted to prompt the user for the beginning date and the end date,
how
would I do that?


Thanks,
Jasper
 
Back
Top