Results 1 to 4 of 4
  1. #1
    Join Date
    Sep 2008
    Location
    NM, USA
    Posts
    97

    Unanswered: Update statement is changing my dates to times.

    I'm having a problem with an update query I am trying to run. In my code, when you go to enter a new credential in my system, it checks to see if the provider and credential already exists, and if it does, asks you if you'd like to update this credential's expiration date, otherwise aborting the action.

    however, whenever I test it and enter in a new date and tell the msgbox yes, i want to change this record, when I pull up the table and look at it, the date is a time. I've attached some screen shots of the program and code and stuff.

    Why on earth is it doing this? The values in the immediate window, and in the locals window are all correct, the format of the textbox the data is read from is "Short Date", and the format of the actually column in the table its self is also Date/Time.

    I'm stumped.
    Attached Thumbnails Attached Thumbnails probScrnShot.bmp   probshot2.bmp   probshot3.bmp  
    "Unix is user friendly... It's just very picky about its friends."

    The best things in life...are well-documented.

  2. #2
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    You need hashes around the date in your update statement.

    You're sending it 10 divided by 15 divided by 2008, which will give it a number that is converted in to a date, instead of 10/15/2008.
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

  3. #3
    Join Date
    Sep 2008
    Location
    NM, USA
    Posts
    97
    Quote Originally Posted by Teddy
    You need hashes around the date in your update statement.

    You're sending it 10 divided by 15 divided by 2008, which will give it a number that is converted in to a date, instead of 10/15/2008.
    by "hashes" you mean... # # <- those things, right?

    The thing I don't get is... in the locals window it says #10/15/2008# for the date...

    So in the SQL statement, I need it to be more like

    strSQL = "UPDATE tblContractorCredentials"
    strSQL = strSQL + "SET dteExpires = #" & Expiration &"#"....

    and so on and so forth?
    "Unix is user friendly... It's just very picky about its friends."

    The best things in life...are well-documented.

  4. #4
    Join Date
    Sep 2008
    Location
    NM, USA
    Posts
    97
    neever mind. I fixed it. ^_^ Thank you.
    "Unix is user friendly... It's just very picky about its friends."

    The best things in life...are well-documented.

Posting Permissions

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