Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2009
    Posts
    3

    Question Unanswered: Update a Date Field

    Hello. I have a table that contains a date/time field.

    On my form, I have a calendar control that I want to populate the date field. Everytime I choose the date on the calendar, it is only storing a time in the field.

    I have tried using an update block, but I get the same results.

    Here is my update block:

    UPDATE purchase SET dateid = 1/12/2009;

    this stores: 12:00:04 AM in the table

    I have also tried this:

    UPDATE dummy SET dateid = format(1/12/2009,"mm/dd/yyyy");

    but I get the same result.

    I have also tried changing the field to a text field. I tried this update block:

    UPDATE dummy SET dateid = format(1/12/2009,"mm/dd/yyyy");

    but it stored: 12/30/1899 in the table.

    I am at a loss right now. Any guidance will be welcomed.

  2. #2
    Join Date
    May 2005
    Posts
    1,191
    You need to tell Access that you're sending it a date and not trying to do arithmetic (1 divided by 12 divided by 2009), so do like:
    Code:
    UPDATE purchase SET dateid = #1/12/2009#;
    EDIT: It may also be helpful for you if you read up on how Microsoft stores dates/times.
    Last edited by nckdryr; 02-03-09 at 11:40.
    Me.Geek = True

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •