Changing the Year in Date Fields

G

Guest

I have to keep the same months and days in my current Date Field. However I
must make all the new dates show the year 2005. The dates I have are all
different.

Expr1: DatePart("m",[HSchool]![HCLBKDT]) & DatePart("d",[HSchool]![HCLBKDT])
& DatePart("yyyy",2005)

The above code is what I have now, but the year comes out 1905.

Does anyone know how to do this in a query?

Thanx

Len
 
R

Rick Brandt

Len said:
I have to keep the same months and days in my current Date Field.
However I must make all the new dates show the year 2005. The dates
I have are all different.

Expr1: DatePart("m",[HSchool]![HCLBKDT]) &
DatePart("d",[HSchool]![HCLBKDT]) & DatePart("yyyy",2005)

The above code is what I have now, but the year comes out 1905.

Does anyone know how to do this in a query?

Thanx

Len

Use DateAdd() function in an update query to add one year to all existing
values.
 
J

John Spencer (MVP)

Try using the DateSerial function to build a new date.

Something along the lines of
DateSerial(2005,Month([YourDateField]),Day([YourDateField]))

You don't say whether you are trying to create new values (dates) or display old
values (dates) as the year 2005 or change your current date values to all be in
2005 permanently. So the general advice above is all I can supply.
 

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