am using the folling piece of code....the error which am getting id syntax error in update staement..........but am unable to rectify it..please helep asap
Dim strQry As String
strQry = "update Table1 set login_name = " & newusername.Text & ", password = " & newpassword.Text & " where id = " & currid1
myConnection.Execute (strQry)
MsgBox ("A recorded has been updated to the database")
End Sub
Private Sub cmdCancel_Click()
Unload Me
End Sub
Private Sub cmdOK_Click()
Dim sqlStr As String
Dim temp As String
Dim temp1 As String
Dim rsData As ADODB.Recordset
sqlStr = "select * from Table1 where login_name='" & txtUserName.Text & "'"
Set rsData = New ADODB.Recordset
rsData.Open sqlStr, myConnection, adOpenStatic, adLockReadOnly
currid1 = rsData.Fields.Item(0)
temp = rsData.Fields.Item(1)
temp1 = rsData.Fields.Item(2)
If txtUserName.Text = temp And txtPassword.Text = temp1 Then
'Me.Hide
'Form2.Show
continue.Visible = True
change.Visible = True
changepassword.Visible = True
newpassword.Visible = True
changeusername.Visible = True
newusername.Visible = True
Else
MsgBox "invalid login_id or password"
End If
rsData.Close
End Sub
Private Sub Form_Load()
Set myConnection = New ADODB.Connection
myConnection.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source= " & App.Path & "\\password.mdb"
myConnection.Open
End Sub
Tags: