List View question

W

whistler

Short and crisp question:

How do you reference to listitems in multi selections in List Views?

any hints are most appreciated...

regards, Jos


--------------= Posted using GrabIt =----------------
------= Binary Usenet downloading made easy =---------
-= Get GrabIt for free from http://www.shemes.com/ =-
 
D

Damon Heron

If you want the items selected, call something like this on each lstbox
click event:

Public Sub Add()
Dim frm As Form, ctl As listbox
Dim varItm As Variant
Set frm = Forms!YourformName
Set ctl = frm!YourlstboxName
' loops thru lstbox to get total selected
For Each varItm In ctl.ItemsSelected
C = C + CSng(ctl.Column(1, varItm)) 'this example just adds the
numbers in columns 1
W = W + CSng(ctl.Column(2, varItm)) 'same as above for column 2
Next varItm
Set ctl = Nothing
Set frm = Nothing
'puts values in textboxes
Me.txtC = C
Me!txtInUse = W
End Sub

Damon
 
A

AccessVandal via AccessMonster.com

Hi,

Something like....

Dim ctl As MSComctlLib.ListItem
For Each ctl In Me.ctlListView.ListItems
If ctl.Selected Then
MsgBox "Row is Selected " & ctl.Value
End If
Next ctl
End Sub
 

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

Similar Threads


Top