+ Reply to Thread
Results 1 to 3 of 3

VBA help needed to delete ListBox selected record from table

  1. #1
    Forum Contributor
    Join Date
    10-30-2011
    Location
    Doha
    MS-Off Ver
    MS office 365
    Posts
    701

    Question VBA help needed to delete ListBox selected record from table

    Hi Gurus...
    I have a table called "tblMaster", a query called "Add to dictionary" and a listbox called lstDelete. The query is created from tblMaster and the listbox row source is "qryMaster". Now I want a code to delete record from tblMaster based on lstDelete selection. Please help me with a code to do the same.


    Thanks,
    Joshi
    Cheers,

    Joshi
    Being with a winner makes you a winner

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2404 Win 11 Home 64 Bit
    Posts
    23,865

    Re: VBA help needed to delete ListBox selected record from table

    Where is the list box? In a form? This will be easier to provide you a solution if you upload a sample of your db. Make sure that there are a representative sample of records. Do not upload the entire db as it will be to big. Make sure that after you sanitize the db and before uploading, you run a compact and repair to make it as small as possible. Next put it in a zip file as this forum does not accept accdb or mdb files to upload.
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Forum Contributor
    Join Date
    04-21-2010
    Location
    Canada
    MS-Off Ver
    Office 2013
    Posts
    120

    Re: VBA help needed to delete ListBox selected record from table

    I have done something similar, but it would depend on how your form is created. I have a staff listing, that manages various data.

    You could make a subform that brings up the record that you selected from the listbox. you can then have a delete record button (or code an action) in the subform.

    The other way I see of doing this is that you can bring up the table (in VBA for double click action of the listbox), and do a search delete of the record.

    This code sample is of the former:
    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Code to delete entire row on sheet when selected in listbox
    By chrismccarthy17 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 02-02-2016, 12:18 AM
  2. VBA to delete rowsource of selected row in listbox
    By chrismccarthy17 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-01-2016, 02:24 PM
  3. [SOLVED] delete rows of selected items on listbox
    By 9599lorenzo in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-30-2015, 01:57 PM
  4. Help: Copy and delete first record from other sheet when user ID is selected
    By oct2mine in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-29-2015, 10:45 PM
  5. [SOLVED] "Delete Selected" in Search Result listbox deletes first row, instead of selected row.
    By Faustus in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-06-2013, 02:11 AM
  6. Delete row source from selected line in ListBox
    By PinkMafia14 in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 02-12-2013, 03:15 PM
  7. Delete record from listbox via Userform
    By Jonathan78 in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 09-19-2011, 03:31 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1