Solved

Multi Select List delete records from table

Posted on 2008-10-01
2
507 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
2 Comments
 
LVL 119

Accepted Solution

by:
Rey Obrero 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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

747 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now