Connecting Tech Pros Worldwide Forums | Help | Site Map

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

PMBragg
Guest
 
Posts: n/a
#1: Nov 12 '05
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
Guest
 
Posts: n/a
#2: Nov 12 '05

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]


Peter Doering
Guest
 
Posts: n/a
#3: Nov 12 '05

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.
PMBragg
Guest
 
Posts: n/a
#4: Nov 12 '05

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


PMBragg
Guest
 
Posts: n/a
#5: Nov 12 '05

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]


Douglas J. Steele
Guest
 
Posts: n/a
#6: Nov 12 '05

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]


Lyle Fairfield
Guest
 
Posts: n/a
#7: Nov 12 '05

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)
Closed Thread


Similar Microsoft Access / VBA bytes