I want to Retrieve all records for 1st quarter of current year

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I want to retrieve all records using a query to see the 1st or 2nd or 3rd or
4th quarter of the current year. I've tried DatePart and can seem to get it
to work. Can you suggest how this may be done? My date field is called
SMPL_DT. Let me clarify I want a user to hit a button to invoke the macro to
run the query to show all records thus far for say the 4th quarter or
whatever quarter we are in.
 
Try criteria like this:
Between DateSerial(Year(Date()), 3 *((Month(Date)-1) \ 3) + 1, 1)
And DateSerial(Year(Date()), 3 *((Month(Date)-1) \ 3) + 4, 0)
 
Thanks for the response. This is a very interesting criteria I may be able
to use one day, but for this application I was able to create this in my
Query:

(DatePart("yyyy",[IP_SMPL]![SMPL_DT]))

Then, in criteria I have the user enter the year "yyyy".

As long as it works I am sticking to it.

Kevin.
 
Okay. That returns all records for the year (not just one quarter) of
course.

(The function around the field name means that Access cannot use any index
on the field, so it might be be slower.)

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Kevin said:
Thanks for the response. This is a very interesting criteria I may be
able
to use one day, but for this application I was able to create this in my
Query:

(DatePart("yyyy",[IP_SMPL]![SMPL_DT]))

Then, in criteria I have the user enter the year "yyyy".

As long as it works I am sticking to it.

Kevin.


Allen Browne said:
Try criteria like this:
Between DateSerial(Year(Date()), 3 *((Month(Date)-1) \ 3) + 1, 1)
And DateSerial(Year(Date()), 3 *((Month(Date)-1) \ 3) + 4, 0)
 
Back
Top