#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2004
    Posts
    2
    Rep Power
    0

    update year in date field


    I have an Access database where I am trying to update just the Year of a field that is Date/Time type (DATEFIELD) but keep balance of date (its a Y2K repair).
    I have tried :
    Update TABLENAME
    Set Year(DATEFIELD)=2003
    WHERE Year([DATEFIELD])=1903
    So if the current value is 12/1/1903 I would like it to be updated to 12/1/2003
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2004
    Posts
    49
    Rep Power
    11
    Code:
    update TABLENAME
    set [DATEFIELD] = CDate( Format$([DATEFIELD], "MM/DD/") & "2003" )
    where Year([DATEFIELD]) = 1903
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2004
    Posts
    2
    Rep Power
    0
    Thanks, that looks like that will do the trick. Really appreciate it, was stumped. LS

IMN logo majestic logo threadwatch logo seochat tools logo