I have this code to add data to a database i n access, but i´m getting an error on the SQL statement, can anyone of you help me.
I´m using ADO code to connect to the database.
Thanks in advance.
Code:Private Sub Command1_Click() Dim sSQL As String sSQL = "INSERT INTO PPE (ID, Name, Last_Name, Qty_Cov, Qty_Boot, Coverall, Boot, Hardhat, Glasses, Vest, Rig, Date) " sSQL = sSQL & "VALUES (#" & Text1.Text & "#,'" & Text2.Text & "','" & Text3.Text & "',#" & Text4.Text & "#,#" & Text5.Text & "#,'" & Combo1.Text & "','" & Combo2.Text & "','" & Combo3.Text & "','" & Combo4.Text & "','" & Combo5.Text & "','" & Combo6.Text & "',#" & Text6.Text & "#)" cn.Execute sSQL '====================================================== 'CLEAR DATA FROM CONTROL BOXES & SET TODAY´S DATE AGAIN '====================================================== Me.Text1.Text = "" Me.Text2.Text = "" Me.Text3.Text = "" Me.Combo1.Text = "" Me.Combo2.Text = "" Me.Combo3.Text = "" Me.Combo4.Text = "" Me.Combo5.Text = "" Me.Combo6.Text = "" Me.Text4.Text = "" Me.Text5.Text = "" Me.Text6.Text = "" Me.Option1.Value = False Me.Option2.Value = False Me.Option3.Value = False Me.Text1.SetFocus Me.Text6.Text = Format(Now(), "MMM-DD-YYYY") rs.Close End Sub




Reply With Quote