View Full Version : List box multi select


Richie
10-04-2000, 01:28 PM
Is it possible to return the sum of more than one selected amount from a multiselect list box. I can do it as a string but that justs lists entries selected and not the sum of them

Jack Cowley
10-04-2000, 02:10 PM
Dim Ctl As Control, varItm As Variant, Answer As Integer
Dim Criteria(30) As Integer
Set Ctl = Me![YourListBoxName]

For Each varItm In Ctl.ItemsSelected
Criteria(varItm) = Ctl.Column(0, varItm)
Answer = Answer + Criteria(varItm)
Next varItm

This works for me.... If you have more than one column in your list box you will need to make the necessary adjustments to this code.

HTH,
Jack

[This message has been edited by Jack Cowley (edited 10-04-2000).]

Richie
10-05-2000, 08:17 AM
Thanks Jack works a treat.