Using DateAdd function in a update query to add 10 years to the date

adibakale

Board Regular
Joined
Apr 10, 2015
Messages
52
I have a table (tbl_transactions) which has a column(transaction_date) that holds dates in this format mm/dd/yyyy.

The file that is imported has the wrong dates, shows 2005 instead of 2015.

I need to run an update query to correct the dates by adding 10 years to each date in the transaction_date column.

I tried using the DateAdd function but it is not updating correctly and I am stuck.

Here is what I tried so far and I don't know what to put after the 4 x's are in the example below:

DateAdd(yyyy,10,xxxx)

I don't want to change the month or day, only add 10 years to the date.

Any help with this is greatly appreciated
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
Try this where the Field Name [Field6] needs to be changed to your field name

Code:
UPDATE Sheet1 SET Sheet1.Field6 = DateAdd("yyyy",10,[field6])
WHERE (((Sheet1.Field6) Is Not Null));

and change the table name from Sheet1 to your table name.
 
Upvote 0

Forum statistics

Threads
1,214,945
Messages
6,122,395
Members
449,081
Latest member
JAMES KECULAH

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top