I would like to update a specific record using below code. However it needs a bit of modification, as it updates all records, as it is right now.
I need it to update a record based on a value which is in a textbox.
I have tried including a WHERE clause, but that doesn't work. It just goes directly to the msgbox then.
Cam some one tell me how to get that included?
I need it to update a record based on a value which is in a textbox.
I have tried including a WHERE clause, but that doesn't work. It just goes directly to the msgbox then.
Cam some one tell me how to get that included?
Code:
Private Sub cmdAdd1_Click()
Dim strAdd1 As String
If Me.cboSJANumber1 = Null Or Me.cboSJANumber1 = "" Then
strAdd1 = "UPDATE tblUSerDetails SET tblUserDetails.Favourite1 = '" & Me.cboSJANumber1 & "'"
CurrentProject.Connection.Execute strAdd1
Else
MsgBox ("Please choose a SJA first!")
Exit Sub
End If
End Sub