Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > Beginning VB 6
|
Beginning VB 6 For coders who are new to Visual Basic, working in VB version 6 (not .NET).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning VB 6 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 20th, 2004, 09:31 AM
Authorized User
 
Join Date: Jun 2003
Posts: 46
Thanks: 0
Thanked 0 Times in 0 Posts
Default Remove entries from listview on click

Hi All,

I have a listview that contains users and I want to multiselect them and click a remove button and have them deleted from the Access Database.

Any ideas??

Many thanks,

Paul
 
Old September 28th, 2004, 09:46 AM
Authorized User
 
Join Date: Sep 2004
Posts: 55
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to Lalit_Pratihari
Default

Hi Paul,

If you would like to multi-select the users from a ListView control then you have to check on the option for checkboxes.

Do This
--> Right click on the ListView control
--> Click Properties
--> In the General Tab select CheckBoxes
--> Click Column Headers Tab
--> Assign Appropriate Names
--> Click OK

Now you will able to select multiple users from the same ListView Control.

If you want to delete the selected users:

If ListView1.ListItems.Count > 0 Then
    For i = 1 To ListView1.ListItems.Count
        If ListView1.ListItems(i).Checked = True Then
            SQL "Delete from User_Table Where USer_Name ='" & Trim(ListView1.ListItems(i).Text) & "'"
            'Execute the delete statement
            i = i - 1
        End If
        If i = ListView1.ListItems.Count Then
            Exit Sub
        End If
    Next
End If

Hope this helps,

Thanks,

Lalit
Life Means More...;)
 
Old September 28th, 2004, 09:50 AM
Friend of Wrox
 
Join Date: Jul 2003
Posts: 128
Thanks: 0
Thanked 1 Time in 1 Post
Default

Paul,
I suggest you create a field with data type Yes/No where you have you list in a table. For example, field name remove. Then create a form, with a view: Continuous Forms. In this form create a check box bound to the remove field. Then create command button with a vb code
to delete all remove check boxes that are checked or with Yes value.
I hope this helps.
john








Similar Threads
Thread Thread Starter Forum Replies Last Post
Display ListView click value Intel.Leiria Access VBA 0 September 27th, 2005 03:09 PM
Remove entries from listview on click neo_jakey Pro VB 6 3 December 23rd, 2004 04:44 PM
Remove entries from listview and database on click neo_jakey Pro VB Databases 1 September 20th, 2004 12:21 PM
Remove entries from listview and database on click neo_jakey VB Databases Basics 2 September 20th, 2004 10:37 AM
Remove entries in a list box rfinks Classic ASP Basics 1 October 15th, 2003 12:48 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.