how to insert date format into access 2003

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

    how to insert date format into access 2003

    hi to all
    iam using vb6.0
    can any one correct me

    the query which below mentioned is correct

    strSql = "Insert into table1 values (#" & Date & "# ,'2')"
    Set rs = objCon.Execute( strSql)

    or
    the date format has to send like a string
    strSql = "Insert into table1 values ('" & de & "' ,'2')"
    Set rs = objCon.Execute( strSql)
  • jeffstl
    Recognized Expert Contributor
    • Feb 2008
    • 432

    #2
    Originally posted by chandru8
    hi to all
    iam using vb6.0
    can any one correct me

    the query which below mentioned is correct

    strSql = "Insert into table1 values (#" & Date & "# ,'2')"
    Set rs = objCon.Execute( strSql)

    or
    the date format has to send like a string
    strSql = "Insert into table1 values ('" & de & "' ,'2')"
    Set rs = objCon.Execute( strSql)
    I am pretty sure for Access the correct format is

    [code=vb]
    strSql = "Insert into table1 values (#" & Date & "# ,'2')"
    Set rs = objCon.Execute( strSql)
    [/code]

    If you get an error using that please post, but I think that is correct.

    Comment

    • chandru8
      New Member
      • Sep 2007
      • 145

      #3
      am not getting error i need to use this access in multi user format so the date format is changing according to the reginal setting is there any way to generalise the date format

      Comment

      • lotus18
        Contributor
        • Nov 2007
        • 865

        #4
        Originally posted by chandru8
        am not getting error i need to use this access in multi user format so the date format is changing according to the reginal setting is there any way to generalise the date format
        Try the format function.

        Rey Sean

        Comment

        • chandru8
          New Member
          • Sep 2007
          • 145

          #5
          i tried that also up 01/04/2008(dd/mm/yyyy) to 12/04/2008(dd/mm/yyyy)
          its saving in the access as 04/01/2008 ,04/02/2008 .....04/12/2008

          after 12
          1st saving 13 th date as
          13/04/2008
          14/04/2008
          .
          .
          .
          31/04/2008

          i used format function

          and also
          de = Format(DateSeri al(Year(Calenda r1.Value), Month(Calendar1 .Value), Day(Calendar1.V alue)), "mm/dd/YYYY")
          strSql = "Insert into table3 values (#" & de & "#)"
          Set rs = objCon.Execute( strSql)


          is there any way to specify the general format in msaccess 2003

          thanks

          Comment

          • lotus18
            Contributor
            • Nov 2007
            • 865

            #6
            So you are using 'Short Date' format in your access?

            Rey Sean

            Comment

            • chandru8
              New Member
              • Sep 2007
              • 145

              #7
              i tried to change the format what my regional settings have
              but the value is swaping up to 12

              Comment

              • Tenneyson
                New Member
                • Apr 2008
                • 17

                #8
                Code:
                Private Sub Command1_Click()
                Dim mydate
                    mydate = Format(Date, "DD-MM-YYYY")
                    MsgBox "" & mydate
                End Sub

                try to play around with this in your VB 6 for your date format

                Comment

                • chandru8
                  New Member
                  • Sep 2007
                  • 145

                  #9
                  Have You Understand My Problem

                  The Problem Is Not With Vb6.0 And I Know About The Format Statement

                  The Problem Is
                  How To Store Our Desired Format Without The Regional Settings Date Format

                  Comment

                  • chandru8
                    New Member
                    • Sep 2007
                    • 145

                    #10
                    Any One Correct Me
                    Can I Declare That Date Data Type As Text

                    If I Declared As Text It Will Satisfies All The Calculation What We Do For The Date



                    Its Urgent Iam Doing This For Two Days
                    Thanks

                    Comment

                    Working...