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

date / time question

P: n/a
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
Share this Question
Share on Google+
1 Reply


P: n/a
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.