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
 

Some videos you may like

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off

alansidman

Well-known Member
Joined
Feb 26, 2007
Messages
5,620
Office Version
2019
Platform
Windows
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.
 

Watch MrExcel Video

Forum statistics

Threads
1,100,201
Messages
5,473,129
Members
406,846
Latest member
otown2221

This Week's Hot Topics

Top