Hi friends!
I have a piece of code that I think should be working just fine, but I wonder why it doesn't work, and I get an "Syntax Error in INSERT statement" error message.
Here is the code to affect a table called "Users" in my Access database.
Dim cmd As OleDb.OleDbCommand
Dim sSQL As String
con.Open()
sSQL = "INSERT INTO Users (Username, Password) " _
+ "VALUES ('" & Trim(Me.txtUser1.Text) & "', '" & Trim(Me.txtPass1.Text) & "') "
cmd = New OleDb.OleDbCommand
With cmd
.CommandType = CommandType.Text
.CommandText = sSQL
.Connection = con
End With
cmd.ExecuteNonQuery()
MsgBox("information updated succesfully", vbInformation)
con.Close()
Thanks all.