Results 1 to 11 of 11
  1. #1
    Join Date
    Feb 2002
    Location
    Silver Spring, Maryland
    Posts
    74

    Unanswered: Date Part only from MS Access Date picker control

    I am using the "microsoft access date/ time picker" control to pick dates. These dates like termination date of a contract will end up in the database. The problem I have is that when I do this,

    rst!dateIntoForce = Me!ActiveXCtlDOForce

    I end up with this in my database:

    1/6/2003 5:48:43 PM

    How can I extract only the date part from "1/6/2003 5:48:43 PM" so that only

    1/6/2003

    goes into the database


    Thanks

  2. #2
    Join Date
    Sep 2002
    Location
    Land of OZ
    Posts
    173

    Re: Date Part only from MS Access Date picker control

    Originally posted by Wango
    I am using the "microsoft access date/ time picker" control to pick dates. These dates like termination date of a contract will end up in the database. The problem I have is that when I do this,

    rst!dateIntoForce = Me!ActiveXCtlDOForce

    I end up with this in my database:

    1/6/2003 5:48:43 PM

    How can I extract only the date part from "1/6/2003 5:48:43 PM" so that only

    1/6/2003

    goes into the database


    Thanks
    Mona
    ________________________________
    Life is too short to be sane or sensible. Weird people rule and normal people suck

  3. #3
    Join Date
    Sep 2002
    Location
    Land of OZ
    Posts
    173

    Re: Date Part only from MS Access Date picker control

    Try This

    rst!dateIntoForce = cDate(Me!ActiveXCtlDOForce)

    I have not tested this .. it was just a passing thought
    Mona
    ________________________________
    Life is too short to be sane or sensible. Weird people rule and normal people suck

  4. #4
    Join Date
    Feb 2002
    Posts
    2,232
    You can use the format function:

    rst!dateIntoForce = format(Me!ActiveXCtlDOForce,"mm/dd/yyyy")

  5. #5
    Join Date
    Feb 2002
    Location
    Silver Spring, Maryland
    Posts
    74
    Sorry it did not work?

  6. #6
    Join Date
    Feb 2002
    Posts
    2,232
    What displays back with the format function - use a message box to display the results ? What is the data type returned from the control ?

  7. #7
    Join Date
    Feb 2002
    Location
    Silver Spring, Maryland
    Posts
    74
    I looked at what I put into the database and this is what I find:

    1/9/2003 7:54:27 PM

    That is after using:

    rst!dateIntoForce = CDate(Me!ActiveXCtlDOForce)

    rst!terminationDate = CDate(Me!ActiveXCtlTermDate)

  8. #8
    Join Date
    Sep 2002
    Location
    Land of OZ
    Posts
    173
    what about using the format option ... what does that return...

    Originally posted by Wango
    I looked at what I put into the database and this is what I find:

    1/9/2003 7:54:27 PM

    That is after using:

    rst!dateIntoForce = CDate(Me!ActiveXCtlDOForce)

    rst!terminationDate = CDate(Me!ActiveXCtlTermDate)
    Mona
    ________________________________
    Life is too short to be sane or sensible. Weird people rule and normal people suck

  9. #9
    Join Date
    Feb 2002
    Posts
    2,232
    Thanks Mona - that was what I was after.

  10. #10
    Join Date
    Feb 2002
    Location
    Silver Spring, Maryland
    Posts
    74
    Thnaks guys, it worked like a charm. Happy new year.

    Wango

  11. #11
    Join Date
    Feb 2002
    Posts
    2,232
    Happy to help - good luck.

Posting Permissions

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