Hi
I am new to Access. I am trying to create a form which has a listbox related to my table and 2 buttons. One to add a new item to list box(Add new record) and one to remove.
The code for remove is this
Private Sub List0_Click()
Dim SelectCost As String
Dim RNo As Integer
TempVars("SelectCost").Value = Me!List0.ItemData(Me!List0.ListIndex)
End Sub
Private Sub Remove_Cost_ID_Click()
Dim strQuery As String
Dim IDToDelete As String
IDToDelete = TempVars("SelectCost").Value
If IDToDelete <> "" Then
strQery = " delete dbo.cost_centres where cost_id = '" & IDToDelete & "' "
DoCmd.RunSQL strQery
End If
End Sub
But it does not work. I get error message that the operand is missing.
Would you please help me?
Thank you