Multi Select List delete records from table
Posted on 2008-10-01
I have a multi select list box that I'm appending records to 1 table but I want to delete records from another table. I'm not getting any errors in the code below. It Appends records to my table tblOOSInventory but it's not deleting the records in my tblItemsIssued. I'm not sure if there is an issue in my delete statement or not.
Any help would greatly be appreciated.
Dim strItems As String
Dim intItem, sql, SQL2
For intItem = 0 To .ListCount - 1
If .Selected(intItem) Then
strItems = strItems & .Column(0, intItem) & "," & _
.Column(1, intItem) & "," & _
Chr(39) & .Column(2, intItem) & Chr(39) & "," & _
Chr(39) & .Column(3, intItem) & Chr(39) & "," & _
Chr(39) & .Column(4, intItem) & Chr(39) & "," & _
Chr(39) & .Column(5, intItem) & Chr(39)
sql = "Insert into tblOOSInventory(InvIssID, EmpID, IssBC, InvType, Size, ILOC) values (" & strItems & ")"
strItems = ""
SQL2 = "Delete * FROM tblItemsIssued Where InvIssID= "
SQL2 = SQL2 & List2.Selected(intItem) & ";"