i had a problem in the date format

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • chandru8
    New Member
    • Sep 2007
    • 145

    i had a problem in the date format

    hi to all
    i am using vb6.0 and msaccess 2003

    iam inserting date like the query mentioned below
    strSql = "Insert into table1 values (#" & Date & "# )"

    the problem is ..,

    for the 1ST date if april it inserted like 04/01/2008

    so i changed the properties in the msaccess table .After that also its saving like that only i thought the msaccess took the date format as mm/dd/yyyy

    but after 10 th date of april

    its inserting like 10/04/2008

    i dont know what to do

    can any one help in this .


    its urgent

    thanks in advance
  • debasisdas
    Recognized Expert Expert
    • Dec 2006
    • 8119

    #2
    You need to foramt the date before processing in database.

    Comment

    • chandru8
      New Member
      • Sep 2007
      • 145

      #3
      i have done that also my sys format is dd/mm/yyyy
      up to 12 the format is mm/dd/yyyy
      after that it changing like 13/04/2008

      Comment

      • chandru8
        New Member
        • Sep 2007
        • 145

        #4
        date
        1/4/2008
        2/4/2008
        3/4/2008
        4/4/2008
        5/4/2008
        6/4/2008
        7/4/2008
        8/4/2008
        9/4/2008
        10/4/2008
        11/4/2008
        12/4/2008
        4/13/2008
        4/14/2008
        4/15/2008
        4/16/2008
        4/17/2008
        4/18/2008




        iam getting the date like this can any one help me

        Comment

        • lotus18
          Contributor
          • Nov 2007
          • 865

          #5
          Originally posted by chandru8
          date
          1/4/2008
          2/4/2008
          3/4/2008
          4/4/2008
          5/4/2008
          6/4/2008
          7/4/2008
          8/4/2008
          9/4/2008
          10/4/2008
          11/4/2008
          12/4/2008
          4/13/2008
          4/14/2008
          4/15/2008
          4/16/2008
          4/17/2008
          4/18/2008

          iam getting the date like this can any one help me
          The date format in your access and in your sql statement should be in the same format (mm/dd/yyyy).

          Rey Sean

          Comment

          • chandru8
            New Member
            • Sep 2007
            • 145

            #6
            my sys date format is mm/dd/yyyy
            but some of my user machines date format is different i dont know how to use the generalised date format

            Comment

            • lotus18
              Contributor
              • Nov 2007
              • 865

              #7
              Originally posted by chandru8
              my sys date format is mm/dd/yyyy
              but some of my user machines date format is different i dont know how to use the generalised date format
              There's no problem with that. Just format the date like this:

              [CODE=vb]strSql = "Insert into table1 (YourFieldName) values (#" & format(Date, "mm/dd/yyyy") & "# )"
              [/CODE]

              Rey Sean

              Comment

              Working...