select listview checkboxes using VBA

M

Marco

hi,
i coded an access 2007/VBA form with an activeX listview.
the property checkboxes is set to true so that i have a checkbox in every
line of my listview.
the listview is fine, but i'd like to select the checkboxes using VBA to
show e.g. if a personen listed in this list has a certain property or not...
which command do i have to use.
to explain again:
if i press a button, all checkboxes of women in my list should be selected,
the checkboxes of all men rest unselected...

let's say my listview object is defined as following:
Private WithEvents m_objLv1 As MSComctlLib.ListView
Set m_objLv2 = Me!ClientsLV.Object

what do i have to code???
 
D

Douglas J. Steele

You need to loop through the ListItems collection, setting the Checked
property appropriately:

Dim liCurr As ListItem

For Each liCurr In Me!ClientsLV.ListItems
liCurr.Checked = (liCurr.SubItems(2) = "Woman")
Next liCurr

(or however you identify the women for your situation)
 
M

Marco

thanks Douglas, you saved my life ;-) ... or at least my project.
greetings from the land of the beer...germany
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top