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

check your other thread.
i have already been replied.

regards
Shouvik

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.