Another Date Query

T

Tony Williams

I am running an update query using the DateAdd function. I have a
commencement date (txtissuedate) a duration in years (txtduration) and an
expiry date (txtexpirydate) I want to calculate the expiry date and update
the records. I am using this expression
DateAdd("y",[txtDuration],[txtissuedate])
But it is adding duration as a number of days instead of years eg 25 March
2006 becomes 28 March 2006 instead of 25 March 2009.
What am doing wrong I thought "y" added years??
Thanks
Tony
 
T

tina

the DateAdd Function topic in Access Help tells you that "y" = "Day of
year". to add *years*, use "yyyy". though if the issue date and the duration
are stored in a data table, i wouldn't store the expiry date at all - just
calculate it on the fly whenever needed, using the DateAdd() function.

hth
 
T

Tony Williams

Thanks John should have checked help but my book says "Y"
Thanks again
Tony
John Spencer said:
Check the help.

YYYY = years
y = day of year (1-366)

Tony said:
I am running an update query using the DateAdd function. I have a
commencement date (txtissuedate) a duration in years (txtduration) and an
expiry date (txtexpirydate) I want to calculate the expiry date and
update
the records. I am using this expression
DateAdd("y",[txtDuration],[txtissuedate])
But it is adding duration as a number of days instead of years eg 25
March
2006 becomes 28 March 2006 instead of 25 March 2009.
What am doing wrong I thought "y" added years??
Thanks
Tony
 
S

Sidz

Hey, I am also trying to run a similar query - it adds a week to the previous
date. But every time I try to run it, It says "Data Type Mismatch" though I
know for certain that the data type in the table is a Date/Time field.......
Please help!!!

Tony Williams said:
Thanks John should have checked help but my book says "Y"
Thanks again
Tony
John Spencer said:
Check the help.

YYYY = years
y = day of year (1-366)

Tony said:
I am running an update query using the DateAdd function. I have a
commencement date (txtissuedate) a duration in years (txtduration) and an
expiry date (txtexpirydate) I want to calculate the expiry date and
update
the records. I am using this expression
DateAdd("y",[txtDuration],[txtissuedate])
But it is adding duration as a number of days instead of years eg 25
March
2006 becomes 28 March 2006 instead of 25 March 2009.
What am doing wrong I thought "y" added years??
Thanks
Tony
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top