469,342 Members | 5,935 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,342 developers. It's quick & easy.

date / time question

am tring to add a number of years to a dob. im doing this by adding my
date+years*365.26 I get a string of numbers. I then convert the number in
the next column to actual date again. I'm getting the correct date. Now I
want my criteria on that column to allow me to return only date in a given
to from period of my choosing. I try the between_and functions but nothing
is returned. I'm guessing it's because the column is still a calculation and
not a true date.
I'm trying to add my dob column to a column that has a certian number of
years (each record is differrent) and then add a criteria to my result
column that allows me to retrieve only records for dates within a date date
range. I want to determine the date range each time I run the query.
I've tried: Adding a column to my query to convert the number string back to
date format (criteria failed to return a result). Adding a second column
that ='s my converted number to date column (criteria failed to return a
result)
make table query and then run another query from the new table. I can't seem
to make this happen. I think it's not recognizing my data as a date because
it isn't returning any data.
Is ther an easier way to: Add a number of years to a date and have it return
a date and not the number string?
If not is there a better way to convert the string to a date?
Is there a way to get my criteria to recognize the date and return date
between my begin and end dates?
Thanks

John
Nov 13 '05 #1
1 1599
I believe you need to use the DateAdd function.

SELECT tb_Dates.DOB, tb_Dates.Yrs, DateAdd("yyyy",[Yrs],[dob]) AS NewDate
FROM tb_Dates;

DOB Yrs NewDate
01/02/2005 5 01/02/2010
02/02/2005 3 02/02/2008
05/02/2005 21 05/02/2026
05/02/2005 6 0 5/02/2011
01/03/2005 1 01/03/2006

"John Feeley" <jf*****@comcast.net> wrote in message
news:wd********************@comcast.com...
am tring to add a number of years to a dob. im doing this by adding my
date+years*365.26 I get a string of numbers. I then convert the number in
the next column to actual date again. I'm getting the correct date. Now I
want my criteria on that column to allow me to return only date in a given
to from period of my choosing. I try the between_and functions but nothing
is returned. I'm guessing it's because the column is still a calculation and
not a true date.
I'm trying to add my dob column to a column that has a certian number of
years (each record is differrent) and then add a criteria to my result
column that allows me to retrieve only records for dates within a date date
range. I want to determine the date range each time I run the query.
I've tried: Adding a column to my query to convert the number string back to
date format (criteria failed to return a result). Adding a second column
that ='s my converted number to date column (criteria failed to return a
result)
make table query and then run another query from the new table. I can't seem
to make this happen. I think it's not recognizing my data as a date because
it isn't returning any data.
Is ther an easier way to: Add a number of years to a date and have it return
a date and not the number string?
If not is there a better way to convert the string to a date?
Is there a way to get my criteria to recognize the date and return date
between my begin and end dates?
Thanks

John
Nov 13 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

7 posts views Thread by What-a-Tool | last post: by
2 posts views Thread by mirza i | last post: by
7 posts views Thread by Jerome | last post: by
13 posts views Thread by maflatoun | last post: by
9 posts views Thread by Martin | last post: by
6 posts views Thread by Geoff Cox | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.