By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,460 Members | 2,215 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,460 IT Pros & Developers. It's quick & easy.

Query Specific Years

P: n/a
Hi,
Access 2003. I would like to query specific dates or years. I need to
be able to selct the dates in a query, ie aug 12 2004, aug 11th 2004,
or 2001, 2002 and 2003.
Any help is most appreciated
Nov 13 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Use the WHERE clause. E.g.:

SELECT ...
FROM ...
WHERE date_column in (#8/12/04#, #8/11/04#)

or

WHERE Year(date_column) in (2001, 2002, 2003)

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

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

iQA/AwUBQRvEJ4echKqOuFEgEQJYngCfT+9HUhN77Y42WJimZebdJo ilbZEAoNuJ
ZAzeol4bJy8Flqmmf2xeluZK
=gmJ3
-----END PGP SIGNATURE-----
Jerry wrote:
Hi,
Access 2003. I would like to query specific dates or years. I need to
be able to selct the dates in a query, ie aug 12 2004, aug 11th 2004,
or 2001, 2002 and 2003.
Any help is most appreciated


Nov 13 '05 #2

P: n/a
my*******@hotmail.com (Jerry) wrote in message news:<65**************************@posting.google. com>...
Hi,
Access 2003. I would like to query specific dates or years. I need to
be able to selct the dates in a query, ie aug 12 2004, aug 11th 2004,
or 2001, 2002 and 2003.
Any help is most appreciated


This is a vague question... you want to be able to specify *any*
combination of {month, day, year}? and return values? or a single
date or a single month? One way might be to have a start date broken
out, like

Start Month: [1-12] Start Day: [1-31] Start Year: [ ]

and then use VB to determine which controls are empty and open the
appropriate query based on what's filled in. (or assign a report's
recordsource based on the query you need or whatever). You can use
DateSerial to put the pieces together...

If you're only specifying a single day, then you can just create an
unbound textbox that's formatted as a date and then fill it in and
point your query at that.

SELECT ...
FROM ...
WHERE SomeDate = Forms!MyUnboundForm!MyDateControl;
Nov 13 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.