Results 1 to 3 of 3
  1. #1
    gretarocio is offline Novice
    Windows 10 Access 2016
    Join Date
    Jan 2021
    Posts
    4

    Clear Button in combo box and list box

    Hi



    I would like to Clear a cascading combo box (cmb ...) and list box (lstData) (select multiple items)
    I used the code below but it only works for combo boxes.
    Private Sub btnClean_Click()
    Me.cmbProjectData = " "
    Me.cmbDatasetData = " "
    Me.lstData = " "


    Me.cmbProjectData.SetFocus


    End Sub

    Someone can help

    Thanks
    Attached Thumbnails Attached Thumbnails clearbutton.png  

  2. #2
    Welshgasman is online now Expert
    Windows 10 Access 2007
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    621
    I have cleared a multi seelct listbox like this. Might not be the best way, but works?
    Code:
    Private Sub cmdClear_Click()
    Dim i As Integer
    
    For i = Me.lstCrew.ListCount - 1 To 0 Step -1
        Me.lstCrew.Selected(i) = False
    Next
    
    End Sub
    HTH
    Please, please use # when posting code snippets.
    Cross Posting Etiquette: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?search_query=debug+access+vba



  3. #3
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    8,558
    - "doesn't work" doesn't help. Implement changes in copies of your database.
    Iím telling everyone it's good to eat dried grapes. Itís all about raisin awareness.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Clear Button in combo box and list box
    By gretarocio in forum Forms
    Replies: 3
    Last Post: 02-20-2021, 04:57 PM
  2. Replies: 6
    Last Post: 02-15-2015, 11:51 AM
  3. How do I clear the list of recent dbs?
    By revnice in forum Access
    Replies: 4
    Last Post: 01-25-2012, 11:24 AM
  4. Clear value list in combo box
    By jgelpi16 in forum Programming
    Replies: 4
    Last Post: 05-27-2011, 12:45 PM
  5. Clear selections from a List Box?
    By Dreams2Fly in forum Forms
    Replies: 3
    Last Post: 03-28-2011, 02:25 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums - Senior Forums