Query-Access 97 Pulling a Specific Year(s) of Data

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

    Query-Access 97 Pulling a Specific Year(s) of Data

    Thank you everyone that helped me with my DateSerial question. I really do
    appreciate it. Now my accountant has told I need to pull the inventory for
    just the year I'm depreciating. Is there a way to isolate by my [DateIn]
    field, to get the Year I need?

    Michael


  • Scott McDaniel

    #2
    Re: Query-Access 97 Pulling a Specific Year(s) of Data

    Limit the query using the DatePart function:

    SELECT YourRecords WHERE DatePart("yyyy" ,YourDateField) = 2003


    --
    Scott McDaniel
    CS Computer Software
    Visual Basic - Access - Sql Server - ASP
    "PMBragg" <pmbragg@megavi sion.com> wrote in message
    news:7MONb.126$ Wt4.575@news.us west.net...[color=blue]
    > Thank you everyone that helped me with my DateSerial question. I really do
    > appreciate it. Now my accountant has told I need to pull the inventory for
    > just the year I'm depreciating. Is there a way to isolate by my [DateIn]
    > field, to get the Year I need?
    >
    > Michael
    >
    >[/color]


    Comment

    • Peter Doering

      #3
      Re: Query-Access 97 Pulling a Specific Year(s) of Data

      On Fri, 16 Jan 2004 04:10:12 -0600, PMBragg wrote:
      [color=blue]
      > Thank you everyone that helped me with my DateSerial question. I really do
      > appreciate it. Now my accountant has told I need to pull the inventory for
      > just the year I'm depreciating. Is there a way to isolate by my [DateIn]
      > field, to get the Year I need?[/color]

      Year([DateIn])

      HTH - Peter

      --
      No mails please.

      Comment

      • PMBragg

        #4
        Re: Query-Access 97 Pulling a Specific Year(s) of Data

        This works great, but I don't want to have to remember each year to do this.
        Is there a way to do this programmaticall y in a Query?

        Such as DateSerial uses negative or positive numbers to pull certain data?

        <=DateSerial(Ye ar(Date())-5,1,1) And <DateSerial(Yea r(Date()),1,1)

        Pulls all records 5 or more years old. What if I just want the 5th YEAR
        ONLY?

        Michael


        Comment

        • PMBragg

          #5
          Re: Query-Access 97 Pulling a Specific Year(s) of Data

          This works great, but I don't want to have to remember each year to do this.
          Is there a way to do this programmaticall y in a Query?

          Such as DateSerial uses negative or positive numbers to pull certain data?

          <=DateSerial(Ye ar(Date())-5,1,1) And <DateSerial(Yea r(Date()),1,1)

          Pulls all records 5 or more years old. What if I just want the 5th YEAR
          ONLY?

          Michael
          "Peter Doering" <nospam@doering .org> wrote in message
          news:bu8ot2$et9 9i$1@ID-204768.news.uni-berlin.de...[color=blue]
          > On Fri, 16 Jan 2004 04:10:12 -0600, PMBragg wrote:
          >[color=green]
          > > Thank you everyone that helped me with my DateSerial question. I really[/color][/color]
          do[color=blue][color=green]
          > > appreciate it. Now my accountant has told I need to pull the inventory[/color][/color]
          for[color=blue][color=green]
          > > just the year I'm depreciating. Is there a way to isolate by my [DateIn]
          > > field, to get the Year I need?[/color]
          >
          > Year([DateIn])
          >
          > HTH - Peter
          >
          > --
          > No mails please.[/color]


          Comment

          • Douglas J. Steele

            #6
            Re: Query-Access 97 Pulling a Specific Year(s) of Data

            Either create a new column in your query that uses Year([DateIn]), and put
            use Year(Date()) - 5 as the criteria for it (so that you'll have WHERE
            Year([DateIn]) = Year(Date()) - 5), or try

            BETWEEN DateSerial(Year (Date())-5,1,1) AND DateSerial(Year (Date())-5,12,31)

            (If DateIn contains time as well as date, you'll need to use
            DateSerial(Year (Date())-4,1,1) to ensure that you get everything from Dec
            31st)

            --
            Doug Steele, Microsoft Access MVP

            (No private e-mails, please)



            "PMBragg" <pmbragg@megavi sion.com> wrote in message
            news:VGUNb.471$ 9a.11817@news.u swest.net...[color=blue]
            > This works great, but I don't want to have to remember each year to do[/color]
            this.[color=blue]
            > Is there a way to do this programmaticall y in a Query?
            >
            > Such as DateSerial uses negative or positive numbers to pull certain data?
            >
            > <=DateSerial(Ye ar(Date())-5,1,1) And <DateSerial(Yea r(Date()),1,1)
            >
            > Pulls all records 5 or more years old. What if I just want the 5th YEAR
            > ONLY?
            >
            > Michael
            > "Peter Doering" <nospam@doering .org> wrote in message
            > news:bu8ot2$et9 9i$1@ID-204768.news.uni-berlin.de...[color=green]
            > > On Fri, 16 Jan 2004 04:10:12 -0600, PMBragg wrote:
            > >[color=darkred]
            > > > Thank you everyone that helped me with my DateSerial question. I[/color][/color][/color]
            really[color=blue]
            > do[color=green][color=darkred]
            > > > appreciate it. Now my accountant has told I need to pull the inventory[/color][/color]
            > for[color=green][color=darkred]
            > > > just the year I'm depreciating. Is there a way to isolate by my[/color][/color][/color]
            [DateIn][color=blue][color=green][color=darkred]
            > > > field, to get the Year I need?[/color]
            > >
            > > Year([DateIn])
            > >
            > > HTH - Peter
            > >
            > > --
            > > No mails please.[/color]
            >
            >[/color]


            Comment

            • Lyle Fairfield

              #7
              Re: Query-Access 97 Pulling a Specific Year(s) of Data

              "PMBragg" <pmbragg@megavi sion.com> wrote in
              news:PGUNb.470$ 9a.11762@news.u swest.net:
              [color=blue]
              > This works great, but I don't want to have to remember each year to do
              > this. Is there a way to do this programmaticall y in a Query?[/color]

              Has it occurred to you that, perhaps, you could exercise a tiny bit of
              initiative, that you could read the documentation on dates and date
              functions, that you could make several tries, and that you could solve these
              pathetic little problems all by yourself?

              There is no Royal Road to Geometry!

              --
              Lyle
              (for e-mail refer to http://ffdba.com/contacts.htm)

              Comment

              Working...