Update a year in a date field

Mark Powell 0 Reputation points
2025-11-30T07:23:52.4166667+00:00

hi i have a access db with a date field that hold data in the following format

02/10/2024 11:01:29

all i want to do is to be able on mass to update anything in the 24 year to 25, is there a way this could be done please?

thanks in anticipation

Microsoft 365 and Office | Access | Development
{count} votes

2 answers

Sort by: Most helpful
  1. Viorel 125.6K Reputation points
    2025-11-30T10:43:03.9633333+00:00

    For example, create a query using the SQL Query button from Create tab:

    UPDATE [MyTable]
    SET
        [MyDate] = DateAdd("yyyy", 1, [MyDate])
    WHERE
        Year([MyDate]) = 2024
    

    Use the name of your table and field.

    Note that 29/02/2024 becomes 28/02/2025.

    0 comments No comments

  2. Ken Sheridan 3,546 Reputation points
    2025-11-30T14:32:17.86+00:00

    As George has said, this would be an unusual course of action. Normally where you want to carry rows forward to another year you would execute an 'append' query to insert new rows, amending the value in the date column, e.g. for a payments table. You then do not lose any data:

    INSERT INTO Payments(PayeeID, PaymentDateTime, Amount) 
    SELECT PayeeID, DATEADD("yyyy", 1, PaymentDateTime), Amount
    FROM Payments
    WHERE YEAR(PaymentDateTime) = 2024;
    

    This example assumes that the table has an autonumber primary key column, into which values will be inserted automatically, and that PayeeID is a foreign key column referencing the primary key of a Payees table.

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.