bunty
07-20-2010, 11:40 AM
Hi all,
I am trying to update some record of my table.The code I have written is not working.Its giving syntax error.I dont know where is the problem?Please tell me what need to change in that code.
Private Sub cmdUpdate_Click()
Dim rs As DAO.Recordset, db As DAO.Database
Dim res As Boolean
Dim query As String
Dim temp
Set db = CurrentDb
query = " Update User set Last_Name='" & txtUserId & "',First_Name= '" & txtFirstName& "',Email_Id= '" & txtEmailId & "',User_Type= '"cmbUserType & "'from User where User_Id='" & txtUserId & "'"
db.Execute query
'If txtUserId = "" Then
'MsgBox "Please select Record first"
If Err.Number = 0 Then
MsgBox "Record Updated successfully." & db.RecordsAffected
Else
MsgBox "Record not Updated The error is: " & Err.DESCRIPTION
End If
End Sub
Thanks.....
I am trying to update some record of my table.The code I have written is not working.Its giving syntax error.I dont know where is the problem?Please tell me what need to change in that code.
Private Sub cmdUpdate_Click()
Dim rs As DAO.Recordset, db As DAO.Database
Dim res As Boolean
Dim query As String
Dim temp
Set db = CurrentDb
query = " Update User set Last_Name='" & txtUserId & "',First_Name= '" & txtFirstName& "',Email_Id= '" & txtEmailId & "',User_Type= '"cmbUserType & "'from User where User_Id='" & txtUserId & "'"
db.Execute query
'If txtUserId = "" Then
'MsgBox "Please select Record first"
If Err.Number = 0 Then
MsgBox "Record Updated successfully." & db.RecordsAffected
Else
MsgBox "Record not Updated The error is: " & Err.DESCRIPTION
End If
End Sub
Thanks.....