Results 1 to 5 of 5
  1. #1
    Join Date
    Sep 2011
    Posts
    66

    Unanswered: pls help how to split date in text box

    text box contains a field NEXT_CAL_DUE_DATE contains date : 01/aug/2011

    when i press enter the code runs but i have a problem if the month and day is within 01 to 09

    i get planyear = 2011
    i get planmonth = 1/
    i get planday = 1/

    but if i have month and day 10,11,12 to 31 ( 15/oct/2011 )

    i get planyear = 2011
    i get planmonth = 10
    i get planday = 15


    this is the code how do i correct the code to remove / in the result textbox

    Private Sub NEXT_CAL_DUE_DATE_Enter()
    planyear.Value = Right([NEXT CAL DUE DATE], 4)
    planmonth.Value = Left([NEXT CAL DUE DATE], 2)
    planday.Value = Mid([NEXT CAL DUE DATE], 3, 2)
    End Sub

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    best solution is to store a value inm a column of the correct data type, whicbh in this case is datetime.
    store numbers in a numeric data type
    and so on.
    it mayinvolve changes in your current design, but in the long term it will pay off
    I'd rather be riding on the Tiger 800 or the Norton

  3. #3
    Join Date
    Sep 2011
    Posts
    66

    data type is date and time

    data type is date and time and " next cal due date " is stored in a field and other field are also in data type date and time still it is not working

    can you help

  4. #4
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    hokay
    couple of points MS Access is a US centric program date literals need to be in the form mm/dd/yyyy. ifyou are supplying the literal to JET SQL then you also need to exncapsualte the date with the hash symbol
    eg
    update mytable set mydatecolumn = "#09/13/2011"

    instead of doping string manipulation use the intrinsic VB date/time functions
    eg
    TargetYear = year(adatevalue)
    targetmonth = month(adatevalue)
    I'd rather be riding on the Tiger 800 or the Norton

  5. #5
    Join Date
    Sep 2011
    Posts
    66

    thanks

    your reply has helped me a lot thankyou veery very much

Posting Permissions

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