473,378 Members | 1,396 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

DateDiff/DateAdd/Date Serial Question for Query ? Access 97

Thank you in advance. I'm trying to pull all inventory items from December
of the previous year back to 4 years for my accountant. I know this can be
done, but I'm drawing a blank. I've tried;

DateDiff("y",-4,DateIn) and get errors

Please any assistance would be greatly appreciated.

Michael

This was my original post. I'm sorry, I meant to ask, how can pull records
from December of last year, programmatically changing each December to the
previous 4 years, to allow them to be dropped from inventory for taxes?

Michael

Nov 12 '05 #1
15 7961
On Tue, 13 Jan 2004 19:25:37 -0600 in comp.databases.ms-access,
"PMBragg" <pm*****@megavision.com> wrote:
Thank you in advance. I'm trying to pull all inventory items from December
of the previous year back to 4 years for my accountant. I know this can be
done, but I'm drawing a blank. I've tried;

DateDiff("y",-4,DateIn) and get errors

Please any assistance would be greatly appreciated.

Michael

This was my original post. I'm sorry, I meant to ask, how can pull records
from December of last year, programmatically changing each December to the
previous 4 years, to allow them to be dropped from inventory for taxes?


Cooking the books eh? <g>

DateDiff("yyyy",-4,DateIn)
--
A)bort, R)etry, I)nfluence with large hammer.
Nov 12 '05 #2
Trevor,

This didn't work, I get NO records and I have inventory that is older than 4
years. I also want to check since December. How do I do that?

Michael
"Trevor Best" <bouncer@localhost> wrote in message
news:ag********************************@4ax.com...
On Tue, 13 Jan 2004 19:25:37 -0600 in comp.databases.ms-access,
"PMBragg" <pm*****@megavision.com> wrote:
Thank you in advance. I'm trying to pull all inventory items from Decemberof the previous year back to 4 years for my accountant. I know this can bedone, but I'm drawing a blank. I've tried;

DateDiff("y",-4,DateIn) and get errors

Please any assistance would be greatly appreciated.

Michael

This was my original post. I'm sorry, I meant to ask, how can pull recordsfrom December of last year, programmatically changing each December to theprevious 4 years, to allow them to be dropped from inventory for taxes?


Cooking the books eh? <g>

DateDiff("yyyy",-4,DateIn)
--
A)bort, R)etry, I)nfluence with large hammer.

Nov 12 '05 #3
On Wed, 14 Jan 2004 10:15:01 -0600 in comp.databases.ms-access,
"PMBragg" <pm*****@megavision.com> wrote:
Trevor,

This didn't work, I get NO records and I have inventory that is older than 4
years. I also want to check since December. How do I do that?


Can you post the SQL of your query?

--
A)bort, R)etry, I)nfluence with large hammer.
Nov 12 '05 #4
field name in query [DateIn].
Format = Short Date mm/dd/yyyy
I have tried:

DateAdd: DateAdd("yyyy",-4,[DateIn]) and get NO
records
Tried:
DateDiff("yyyy",DateAdd("yyyy",-4,[DateIn]),[DateIn]) and NO records.

I have records that are dated 01/05/1998.

What I'm trying to do is pull all records in a query that are newer than 4
years. This is for tax purposes. The inventory that is older than four
years, have been taxed and therefore not taxable! I'm trying to do this in a
Query, using the Criteria in the [DateIn] field, which is a short date
format field; mm/dd/yyyy

HELP

Michael
"Trevor Best" <bouncer@localhost> wrote in message
news:b1********************************@4ax.com...
On Wed, 14 Jan 2004 10:15:01 -0600 in comp.databases.ms-access,
"PMBragg" <pm*****@megavision.com> wrote:
Trevor,

This didn't work, I get NO records and I have inventory that is older than 4years. I also want to check since December. How do I do that?


Can you post the SQL of your query?

--
A)bort, R)etry, I)nfluence with large hammer.

Nov 12 '05 #5
"PMBragg" <pm*****@megavision.com> wrote in
news:kO******************@news.uswest.net:
field name in query [DateIn]. What I'm trying to do is pull all records in a query that are newer than
4 years.


WHERE DateDiff("yyyy",[fldDate],Date())>4;

--
Lyle
(for e-mail refer to http://ffdba.com/contacts.htm)
Nov 12 '05 #6
One More Time!

I need all inventory from the Month of December, Programmatically for Newer
than 4 years. 12/31/2003

It works with DateDiff("yyyy",[datein],Date()), but I loose all the 2000
inventory, since this is Now January according to the criteria!

WHERE DateDiff("yyyy",[fldDate],Date())>4 gave me an error, but removing the
WHERE gives me everything but the 2000 year inventory, since we're in 2004.
I need 4 years back from December of 2003, and this year it will be 4 years
back from December 2004!

Nov 12 '05 #7
"PMBragg" <pm*****@megavision.com> wrote in
news:Rw*****************@news.uswest.net:
One More Time!

I need all inventory from the Month of December, Programmatically for
Newer than 4 years. 12/31/2003

It works with DateDiff("yyyy",[datein],Date()), but I loose all the 2000
inventory, since this is Now January according to the criteria!

WHERE DateDiff("yyyy",[fldDate],Date())>4 gave me an error, but removing
the WHERE gives me everything but the 2000 year inventory, since we're
in 2004. I need 4 years back from December of 2003, and this year it
will be 4 years back from December 2004!


If you want any date occurring >= 2000-01-01 and < 2004-01-01

you could try

DateIn >= DateSerial(2000,01,01) AND DateIn < DateSerial(2004,01,01)

--
Lyle
(for e-mail refer to http://ffdba.com/contacts.htm)
Nov 12 '05 #8
Did you try my suggestion by using the Year function by adding the DateIn
field a second time in the query grid and use the Year function around the
DateIn field and also in the criteria (WHERE condition).
i.e. Expr1: Year([DateIn]) and in the criteria paste the following
=Year(Date())-5 And <=Year(Date())-1 This will display all records from 1999 to 2003 since the current year is
2004.

This equates to (watch wrapping)
WHERE ((Year([DateIn])>=Year(Date())-5) AND
(Year([DateIn])<=Year(Date())-1))

Stewart
"PMBragg" <pm*****@megavision.com> wrote in message
news:Rw*****************@news.uswest.net... One More Time!

I need all inventory from the Month of December, Programmatically for Newer than 4 years. 12/31/2003

It works with DateDiff("yyyy",[datein],Date()), but I loose all the 2000
inventory, since this is Now January according to the criteria!

WHERE DateDiff("yyyy",[fldDate],Date())>4 gave me an error, but removing the WHERE gives me everything but the 2000 year inventory, since we're in 2004. I need 4 years back from December of 2003, and this year it will be 4 years back from December 2004!

Nov 12 '05 #9
Lyle,

It works great, but every year I have to go in and change it. I'm trying to
figure out a way to do it programmatically.

Michael

"Lyle Fairfield" <Mi************@Invalid.Com> wrote in message
news:Xn*******************@130.133.1.4...
"PMBragg" <pm*****@megavision.com> wrote in
news:Rw*****************@news.uswest.net:
One More Time!

I need all inventory from the Month of December, Programmatically for
Newer than 4 years. 12/31/2003

It works with DateDiff("yyyy",[datein],Date()), but I loose all the 2000
inventory, since this is Now January according to the criteria!

WHERE DateDiff("yyyy",[fldDate],Date())>4 gave me an error, but removing
the WHERE gives me everything but the 2000 year inventory, since we're
in 2004. I need 4 years back from December of 2003, and this year it
will be 4 years back from December 2004!


If you want any date occurring >= 2000-01-01 and < 2004-01-01

you could try

DateIn >= DateSerial(2000,01,01) AND DateIn < DateSerial(2004,01,01)

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

Nov 12 '05 #10
Stewart,

This works great, now what do I do, to get all the Inventory that's 4 years
of older in another query?

Michael
"Stewart Allen" <sa****@ThisPartNotVailid.wave.co.nz> wrote in message
news:bu**********@news.wave.co.nz...
Did you try my suggestion by using the Year function by adding the DateIn
field a second time in the query grid and use the Year function around the
DateIn field and also in the criteria (WHERE condition).
i.e. Expr1: Year([DateIn]) and in the criteria paste the following
=Year(Date())-5 And <=Year(Date())-1

This will display all records from 1999 to 2003 since the current year is
2004.

This equates to (watch wrapping)
WHERE ((Year([DateIn])>=Year(Date())-5) AND
(Year([DateIn])<=Year(Date())-1))

Stewart
"PMBragg" <pm*****@megavision.com> wrote in message
news:Rw*****************@news.uswest.net...
One More Time!

I need all inventory from the Month of December, Programmatically for

Newer
than 4 years. 12/31/2003

It works with DateDiff("yyyy",[datein],Date()), but I loose all the 2000
inventory, since this is Now January according to the criteria!

WHERE DateDiff("yyyy",[fldDate],Date())>4 gave me an error, but removing

the
WHERE gives me everything but the 2000 year inventory, since we're in

2004.
I need 4 years back from December of 2003, and this year it will be 4

years
back from December 2004!


Nov 12 '05 #11
"PMBragg" <pm*****@megavision.com> wrote in news:USwNb.2$nP3.11237
@news.uswest.net:
Lyle,

It works great, but every year I have to go in and change it. I'm trying to
figure out a way to do it programmatically.


DateIn >= DateSerial(Year(Date())-4,01,01)
AND
DateIn < DateSerial(Year(Date()),01,01)

--
Lyle
(for e-mail refer to http://ffdba.com/contacts.htm)
Nov 12 '05 #12
That's awesom Lyle. Now how do I get my current Inventory in a like Query,
but all items programmatically back 4 years....lol

Michael

"Lyle Fairfield" <Mi************@Invalid.Com> wrote in message
news:Xn******************@130.133.1.4...
"PMBragg" <pm*****@megavision.com> wrote in news:USwNb.2$nP3.11237
@news.uswest.net:
Lyle,

It works great, but every year I have to go in and change it. I'm trying to figure out a way to do it programmatically.


DateIn >= DateSerial(Year(Date())-4,01,01)
AND
DateIn < DateSerial(Year(Date()),01,01)

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

Nov 12 '05 #13
Nevermind, I figured it out. Thank you again everyone!
"PMBragg" <pm*****@megavision.com> wrote in message
news:ZH*****************@news.uswest.net...
That's awesom Lyle. Now how do I get my current Inventory in a like Query,
but all items programmatically back 4 years....lol

Michael

"Lyle Fairfield" <Mi************@Invalid.Com> wrote in message
news:Xn******************@130.133.1.4...
"PMBragg" <pm*****@megavision.com> wrote in news:USwNb.2$nP3.11237
@news.uswest.net:
Lyle,

It works great, but every year I have to go in and change it. I'm
trying
to figure out a way to do it programmatically.


DateIn >= DateSerial(Year(Date())-4,01,01)
AND
DateIn < DateSerial(Year(Date()),01,01)

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


Nov 12 '05 #14
Nevermind, I figured it out. Thank you again everyone!
"PMBragg" <pm*****@megavision.com> wrote in message
news:AT***************@news.uswest.net...
Stewart,

This works great, now what do I do, to get all the Inventory that's 4 years of older in another query?

Michael
"Stewart Allen" <sa****@ThisPartNotVailid.wave.co.nz> wrote in message
news:bu**********@news.wave.co.nz...
Did you try my suggestion by using the Year function by adding the DateIn field a second time in the query grid and use the Year function around the DateIn field and also in the criteria (WHERE condition).
i.e. Expr1: Year([DateIn]) and in the criteria paste the following
=Year(Date())-5 And <=Year(Date())-1

This will display all records from 1999 to 2003 since the current year is 2004.

This equates to (watch wrapping)
WHERE ((Year([DateIn])>=Year(Date())-5) AND
(Year([DateIn])<=Year(Date())-1))

Stewart
"PMBragg" <pm*****@megavision.com> wrote in message
news:Rw*****************@news.uswest.net...
One More Time!

I need all inventory from the Month of December, Programmatically for

Newer
than 4 years. 12/31/2003

It works with DateDiff("yyyy",[datein],Date()), but I loose all the 2000 inventory, since this is Now January according to the criteria!

WHERE DateDiff("yyyy",[fldDate],Date())>4 gave me an error, but
removing the
WHERE gives me everything but the 2000 year inventory, since we're in

2004.
I need 4 years back from December of 2003, and this year it will be 4

years
back from December 2004!



Nov 12 '05 #15
Thanks everyone. Now is there a way in Access to isolate, in a Query, a
specific year programmatically?

Michael
Nov 12 '05 #16

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: inamori | last post by:
I face that problems 07/01/2003 06/30/2006 ---------> it should be 3 01/01/2003 02/28/2005 --------->could i get 2 years and 2 months 01/01/2003 03/01/2005 ...
1
by: intl04 | last post by:
I'm trying to set up a query that will include a new field ('Days until completion') whose value is derived from the DateDiff function. I think I have the syntax correct but am not sure. Days...
2
by: PMBragg | last post by:
Thank you in advance. I'm trying to pull all inventory items from December of the previous year back to 4 years for my accountant. I know this can be done, but I'm drawing a blank. I've tried; ...
1
by: PMBragg | last post by:
ORINGINAL Post >Thank you in advance. I'm trying to pull all inventory items from December >of the previous year back to 4 years for my accountant. I know this can be >done, but I'm drawing a...
3
by: Annette Massie | last post by:
I am trying to insert a record into a table via code and one of the values to add I would like as a dateadd calculation on a value from a query. My code looks like this: Set db = CurrentDb() ...
5
by: mcbill20 | last post by:
Hello all. I have a really basic question that I hope someone has a better answer for. I apologize in advance-- I know this is probably a really basic question but I am used to Oracle rathern than...
9
by: laurenq uantrell | last post by:
I've gotten sort of fed up with dealing with regional date settings on the client side and am considering the following scheme - just wondering if anyone has a negative view of it or not: ...
6
by: kevinjwilson | last post by:
I am trying to get the date difference between two dates but I don't want the function to include weekends in the calculation. Does anyone have an idea on how to make this work?
4
peeaurjee
by: peeaurjee | last post by:
Hello, I have a query containing Serial, Name, Residence Visa Expiry Date in MS Access 2003. I need to put Residence Visa Registration Date in other field and that would be in reverse I mean 3...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.