Results 1 to 5 of 5
  1. #1
    GraemeG is offline Competent Performer
    Windows Vista Access 2007
    Join Date
    Feb 2011
    Posts
    152

    Update Query to change Renew Dates

    Hello.

    I wanted to create an update query to enforce all Renew Dates within my fields are atleast the current year.

    I have created the following - see picture.

    But all it does it changes everything to "Date" text within the fields.
    Can I create an update query to do such a thing. I.e. The Current field has records with 2010 in and i want to update them to say 2011(current year)

    Any help much aprpeciated

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    If you meant to use the Date() function, it should not be enclosed in quotes. I'd probably use the Year() function instead of Format(), which will return a string.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    GraemeG is offline Competent Performer
    Windows Vista Access 2007
    Join Date
    Feb 2011
    Posts
    152
    Quote Originally Posted by pbaldy View Post
    If you meant to use the Date() function, it should not be enclosed in quotes. I'd probably use the Year() function instead of Format(), which will return a string.
    Sorry not sure what you mean here.

    So in the update query design:
    Update to: Year("yyyy")?
    Criteria: < year("yyyy")?

    Sorry just another note. I was using the Format(Date, "yyyy") in my form for various things, as the field is a textbox not date.

  4. #4
    kennejd is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Mar 2011
    Posts
    188
    You'll notice that in the screenshot you attached that Access converted your function to Format("Date", "yyyy") ....which won't work. If you go with year(date()) or Format(date(),"yyyy") it should work ok.

  5. #5
    GraemeG is offline Competent Performer
    Windows Vista Access 2007
    Join Date
    Feb 2011
    Posts
    152
    Quote Originally Posted by kennejd View Post
    You'll notice that in the screenshot you attached that Access converted your function to Format("Date", "yyyy") ....which won't work. If you go with year(date()) or Format(date(),"yyyy") it should work ok.
    Great stuff - wow.

    It worked a treat using:
    Update to: Year(Date())
    Criteria: <Year(Date())

    Thanks.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Renew Multiple records via a form
    By Phil Knapton in forum Forms
    Replies: 23
    Last Post: 01-01-2011, 07:05 PM
  2. How to change year digit in update query?
    By Osman in forum Queries
    Replies: 6
    Last Post: 10-27-2010, 04:35 AM
  3. change textbox value after combo update
    By arctushar@yahoo.com in forum Forms
    Replies: 5
    Last Post: 09-06-2010, 07:17 PM
  4. Update dates for multiple (not all) records
    By thekruser in forum Access
    Replies: 2
    Last Post: 08-30-2010, 05:27 PM
  5. Update query for 12/30/1899 dates
    By P5C768 in forum Queries
    Replies: 8
    Last Post: 09-25-2009, 09:16 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums