Listbox values

Gregvg

Registered User.
Local time
Today, 11:09
Joined
Dec 23, 2009
Messages
18
I have a multi select listbox. I have a cmd button with the following code in it.
Code:
Me.Text40 = Me.List38.Column(2)
That gives me the value of the first item selected in the listbox. But what I need is the sum of all the items selected in the list box. Can anyone show me how to do this?
 
Along these lines:

Code:
Private Sub lstCharges_AfterUpdate()
  Dim varItem As Variant
  Dim strSQL As String
  Dim ctl As Control
  Dim curTotal As Currency

  Set ctl = Me.lstCharges
  curTotal = 0

  For Each varItem In ctl.ItemsSelected
    curTotal = curTotal + ctl.Column(3, varItem)
  Next varItem
  Me.txtTotalPayments = curTotal

  Set ctl = Nothing
End Sub
 

Users who are viewing this thread

Back
Top Bottom