replace year in field date
-
- PlatinumLounger
- Posts: 4362
- Joined: 26 Apr 2010, 17:36
replace year in field date
How to replace the year in field DATE, without change the dd/mm, based a MyYear var Integer
You do not have the required permissions to view the files attached to this post.
-
- Administrator
- Posts: 78545
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: replace year in field date
Code: Select all
SQL = "UPDATE [MYTABLE] SET [DATE] = DateSerial(" & MyYear & ",Month([DATE]),Day([DATE]))"
Last edited by HansV on 15 Jul 2020, 21:28, edited 1 time in total.
Reason: to correct mistake
Reason: to correct mistake
Best wishes,
Hans
Hans
-
- PlatinumLounger
- Posts: 4362
- Joined: 26 Apr 2010, 17:36
Re: replace year in field date
Peraphs, One closed parenthesis to the last character in SQL?HansV wrote: ↑15 Jul 2020, 19:01Code: Select all
SQL = "UPDATE [MYTABLE] SET [DATE] = DateSerial(" & MyYear & ",Month([DATE]),Day([DATE])"
-
- Administrator
- Posts: 78545
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: replace year in field date
Sorry, there should be two closing parentheses. I will correct my previous reply.
Best wishes,
Hans
Hans
-
- PlatinumLounger
- Posts: 4362
- Joined: 26 Apr 2010, 17:36