Results 1 to 3 of 3
  1. #1
    4 Star Lounger
    Join Date
    Feb 2001
    Location
    Gillingham, Kent, England
    Posts
    511
    Thanks
    0
    Thanked 0 Times in 0 Posts

    ListView Checkboxes (VBA Access 97 SR2)

    I have a form with a list view that displays all of the tables in a database with a checkbox (using the list views checkboxes property) to the left which the user can tick. Would anybody know how to manipulate the data to check to see if each box has been ticked?

    Basically, when the user presses a button, Id like to run through the list and export to .txt any tables that have a tick next to them. So far I have only used List Views to display data, and have not yet done anything with it... until now! Any help would be much appreciated.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: ListView Checkboxes (VBA Access 97 SR2)

    You can use this as the skeleton - you'll have to flesh it out yourself:

    Private Sub cmdMyButton_Click()
    Dim li As ListItem
    For Each li In lvwList.ListItems
    If li.Checked Then
    ' Your action here, for instance:
    MsgBox li.Text
    End If
    Next li
    Set li = Nothing
    End Sub

  3. #3
    4 Star Lounger
    Join Date
    Feb 2001
    Location
    Gillingham, Kent, England
    Posts
    511
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: ListView Checkboxes (VBA Access 97 SR2)

    Excellent, thanks Hans.

    Turns out I wasn't too far off with my experiments, but I had assumed Id have to write it similar to the way list items are added, and had assumed checked had a property of true and false i.e. Li.ListItem.checked = true

    Thanks for clearing that up for me Hans.

Posting Permissions

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