Solved

Multi Select List delete records from table

Posted on 2008-10-01
2
510 Views
Last Modified: 2010-04-21
Hello,

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.

Thanks,
Lisa


Dim strItems As String
    Dim intItem, sql, SQL2

    With Me.List2
    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 & ")"
        Currentdb.Execute sql
        strItems = ""
        SQL2 = "Delete * FROM tblItemsIssued Where InvIssID= "
        SQL2 = SQL2 & List2.Selected(intItem) & ";"
               Currentdb.Execute SQL2
               End If
    Next
    End With
0
Comment
Question by:AnneYourPointIs
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 500 total points
ID: 22614830

        SQL2 = "Delete * FROM tblItemsIssued Where InvIssID= " & .itemdata(intItem)
     
               Currentdb.Execute SQL2
0
 

Author Closing Comment

by:AnneYourPointIs
ID: 31501989
Thank you
0

Featured Post

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Composite queries are used to retrieve the results from joining multiple queries after applying any filters. UNION, INTERSECT, MINUS, and UNION ALL are some of the operators used to get certain desired results.​
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question