PDA

View Full Version : VBA Using SQL Statement to update record based on values in text box



cleteh
01-09-2017, 08:59 AM
I have a command button titled UPDATE RECORD. I am trying to code a click event that allows me to update a record with the values in 2 text boxes. The text boxes are named txtRevisedDueDate and txtRemediationValidatedOn.

The ID of the record comes from the third column in a list box called lstOpenExceptions. I need to use the ID number in the 3rd column of the selected record in the list box. The list box can have several records displaying.

In addition to using that ID number I also need it to update the record that has the ActualIssue column set to False. It is a check box.

Here is the erroneous code I am writing in the click event for the update button. I am also attaching screen shots of the form that contains the text boxes and the button I am coding.
17974

Private Sub cmdUpdate_Click()
Update IssueTracking
SET RevisedDueDate = Me.txtRevisedDueDate, RemediationValidatedOn = Me.txtRemediationValidatedOn
WHERE IssueTracking.MasterID = lstOpenExceptions.Column(2, lstOpenExceptions.ListIndex)
AND IssueTracking.ActualIssue = False
End Sub