Query Specific Years

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jerry

    Query Specific Years

    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
  • MGFoster

    #2
    Re: Query Specific Years

    -----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_colum n) in (2001, 2002, 2003)

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

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

    iQA/AwUBQRvEJ4echKq OuFEgEQJYngCfT+ 9HUhN77Y42WJimZ ebdJoilbZEAoNuJ
    ZAzeol4bJy8Flqm mf2xeluZK
    =gmJ3
    -----END PGP SIGNATURE-----


    Jerry wrote:
    [color=blue]
    > 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[/color]

    Comment

    • Pieter Linden

      #3
      Re: Query Specific Years

      myxmaster@hotma il.com (Jerry) wrote in message news:<65416085. 0408120556.2e7d 8e3b@posting.go ogle.com>...[color=blue]
      > 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[/color]

      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!MyUnbound Form!MyDateCont rol;

      Comment

      Working...