Solved

Multi Select List delete records from table

Posted on 2008-10-01
2
511 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

Does Your Cloud Backup Use Blockchain Technology?

Blockchain technology has already revolutionized finance thanks to Bitcoin. Now it's disrupting other areas, including the realm of data protection. Learn how blockchain is now being used to authenticate backup files and keep them safe from hackers.

Question has a verified solution.

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

It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

630 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