0

hi brother i have a code which saves arecord but it gives an error syntax in insert in to statement. this is ma code. arequest for a collection or an alternative code.
Private Sub cmdsave_Click()
Dim findpas As String
Dim cnnadd As ADODB.Connection
Dim rsadd As ADODB.Recordset
Set cnnadd = New ADODB.Connection
Set rsadd = New ADODB.Recordset

cnnadd.ConnectionString = "data source=" & App.Path & "/account.mdb;" & "provider=microsoft.jet.oledb.4.0;"
cnnadd.Open

rsadd.Open "mytab", cnnadd, adOpenKeyset, adLockPessimistic
cnnadd.Execute "INSERT INTO mytab(FirstName, LastName, UserName, Password, Confirm)" _
& "VALUES('" & txtfn.Text & "','" & txtln.Text & "','" & txtUser.Text & "','" & txtPassword.Text & "','" & txtconfirm.Text & "')"

rsadd.Close
cnnadd.Close


Set cnnadd = Nothing
Set rsadd = Nothing

cmdadd.Enabled = True
cmdsave.Enabled = False
cmdExit.Enabled = True
txtfn.Text = ""
txtln.Text = ""
txtUser.Text = ""
txtPassword.Text = ""
txtconfirm.Text = ""
MsgBox "a user is added", vbOKOnly

thanks

2
Contributors
1
Reply
2
Views
9 Years
Discussion Span
Last Post by choudhuryshouvi
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.