I have the following code:
I am trying to remove/delete an item from a table based on a selection in a list box. This works up until the strsql line, then my value goes to 0. I think my mistake is I need to pass conID as a variant, but am unsure how to restructure it.
Could anyone offer some insight on this one?
Code:
Private Sub Removecontractorbtn_Click()
Dim conid As Long
Dim strsql As String
If IsNull(lstContractorsOnJob) Then
Exit Sub
End If
With Me.lstContractorsOnJob
condid = lstContractorsOnJob.Value
strsql = "DELETE FROM tblContractorJob WHERE ContractorID = " & conid
CurrentDb.Execute strsql
lstContractorsOnJob.Requery
lstContractors.Requery
End With
End Sub
I am trying to remove/delete an item from a table based on a selection in a list box. This works up until the strsql line, then my value goes to 0. I think my mistake is I need to pass conID as a variant, but am unsure how to restructure it.
Could anyone offer some insight on this one?