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

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

P: n/a
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
Nov 12 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a
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" <pm*****@megavision.com> wrote in message
news:7M***************@news.uswest.net...
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

Nov 12 '05 #2

P: n/a
On Fri, 16 Jan 2004 04:10:12 -0600, PMBragg wrote:
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?


Year([DateIn])

HTH - Peter

--
No mails please.
Nov 12 '05 #3

P: n/a
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
Nov 12 '05 #4

P: n/a
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" <no****@doering.org> wrote in message
news:bu************@ID-204768.news.uni-berlin.de...
On Fri, 16 Jan 2004 04:10:12 -0600, PMBragg wrote:
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?


Year([DateIn])

HTH - Peter

--
No mails please.

Nov 12 '05 #5

P: n/a
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" <pm*****@megavision.com> wrote in message
news:VG****************@news.uswest.net...
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" <no****@doering.org> wrote in message
news:bu************@ID-204768.news.uni-berlin.de...
On Fri, 16 Jan 2004 04:10:12 -0600, PMBragg wrote:
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?


Year([DateIn])

HTH - Peter

--
No mails please.


Nov 12 '05 #6

P: n/a
"PMBragg" <pm*****@megavision.com> wrote in
news:PG****************@news.uswest.net:
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?


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)
Nov 12 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.