searching by month/quarter

C

Calvin

I have a combo list with the 12 mths and four quarters.
Each value is assigned with a ID, so 1 for January, 2 for
February so forth. If a user picks the "1st quarter" as
the input, how do I return with 1st quarter and January
to March included.

thx.
 
M

MGFoster

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

You could use the DatePart() function in the WHERE clause. E.g.:

....
WHERE DatePart("q", DateColumn) = 1

This will select all records where the quarter number of the value in
the DateColumn is 1.

Using DatePart() will produce a slower query, 'cuz all records'
DateColumn will have to be evaluated by the DatePart() function to
"decide" if the date is in the indicated qtr.

Or, use the Between comparison, e.g.:

....
WHERE DateColumn BETWEEN #1/1/04# And #3/31/04#

You could use PARAMETERS to refer to dates on a form instead of hard
coding the dates in the query. See the Access help articles on
parameter queries and PARAMETERS.

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQJBJoIechKqOuFEgEQJdyQCZAfaRxXx6e6Ne/RnHnX1QqAGCT+UAnRRl
DI4NdkGMpYpqdKoU/rbiYy6d
=DHkA
-----END PGP SIGNATURE-----
 

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

Top