Hi,
I have a button that will add items to a list from another table and then total the cost of these items by clicking a total button. The problem I am having is that when I remove an item from the list it does not update the recordset so it continues to total the items even though the items are no longer there. Is there something wrong with my code? Help Please!!!! Here is the code I am using in my form.
Thanks in advance.
Private Sub cmdAdd_Click()
If Nz(TextQuantity.Value, "") = "" Then TextQuantity.Value = "1"
If Nz(cmbItem.Value, "") <> "" Then
Dim rs As DAO.Recordset
Set rs = DBEngine(0)(0).OpenRecordset("SELECT Cost FROM [Medical Supplies] WHERE Item = '" & removeApostrophes(cmbItem.Value) & "';")
If Not rs.EOF Then total = total + (CSng(rs!Cost) * CInt(TextQuantity.Value))
lstOrder.AddItem (TextQuantity.Value & "x " & cmbItem.Value)
End If
End Sub
Private Sub cmdremove_Click()
lstOrder.RemoveItem Index:=varItem
On Error GoTo 0
End Sub