Solved

Multi Select List delete records from table

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

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Dsum Function for List Box Data 7 45
Count with a subquery showing details 10 43
What is the proper way to use for criteria in left join? 7 25
VB.net and sql server 4 34
If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

776 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