Insert DTPicker in Access DB

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Nosrej
    New Member
    • Feb 2012
    • 1

    Insert DTPicker in Access DB

    Masters, please help me with my DTPicker.. I want it to be saved in my db (access). But it always says: "Syntax Error in Insert Into Statement"

    And this is my code:

    Dim statement1 As String
    Dim conn1 As ADODB.Connectio n

    Set conn1 = New ADODB.Connectio n
    conn1.Connectio nString = _
    "Provider=Micro soft.Jet.OLEDB. 4.0;" & _
    "Data Source=" & App.Path & "\DB.mdb"
    conn1.Open

    statement1 = "INSERT INTO tblDPSR (Date) VALUES (' " & Me.DTPicker1.va lue & " ' )"

    conn1.Execute statement1, , adCmdText




    ..and my Date in Access is Date/Time
  • thelionheart
    New Member
    • Feb 2012
    • 12

    #2
    Insert DTPicker in Access DB

    you may try this one:

    statement1 = "INSERT INTO tblDPSR (Date) VALUES (' " & DateValue(DTPic ker1.Value) & " ' )"

    conn1.Execute statement1, , adCmdText

    Comment

    Working...