Connecting Tech Pros Worldwide Help | Site Map

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

 
LinkBack Thread Tools Search this Thread
  #1  
Old November 12th, 2005, 06:10 PM
PMBragg
Guest
 
Posts: n/a
Default 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



  #2  
Old November 12th, 2005, 06:10 PM
Scott McDaniel
Guest
 
Posts: n/a
Default 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@megavision.com> wrote in message
news:7MONb.126$Wt4.575@news.uswest.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]


  #3  
Old November 12th, 2005, 06:10 PM
Peter Doering
Guest
 
Posts: n/a
Default 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.
  #4  
Old November 12th, 2005, 06:11 PM
PMBragg
Guest
 
Posts: n/a
Default 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 programmatically in a Query?

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

<=DateSerial(Year(Date())-5,1,1) And <DateSerial(Year(Date()),1,1)

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

Michael


  #5  
Old November 12th, 2005, 06:11 PM
PMBragg
Guest
 
Posts: n/a
Default 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 programmatically in a Query?

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

<=DateSerial(Year(Date())-5,1,1) And <DateSerial(Year(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$et99i$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]


  #6  
Old November 12th, 2005, 06:11 PM
Douglas J. Steele
Guest
 
Posts: n/a
Default 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
http://I.Am/DougSteele
(No private e-mails, please)



"PMBragg" <pmbragg@megavision.com> wrote in message
news:VGUNb.471$9a.11817@news.uswest.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 programmatically in a Query?
>
> Such as DateSerial uses negative or positive numbers to pull certain data?
>
> <=DateSerial(Year(Date())-5,1,1) And <DateSerial(Year(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$et99i$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]


  #7  
Old November 12th, 2005, 06:11 PM
Lyle Fairfield
Guest
 
Posts: n/a
Default Re: Query-Access 97 Pulling a Specific Year(s) of Data

"PMBragg" <pmbragg@megavision.com> wrote in
news:PGUNb.470$9a.11762@news.uswest.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 programmatically 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)
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,840 network members.