Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

total referenced in field from a multi select column

Status
Not open for further replies.

farnorth

Technical User
Aug 14, 2002
32
US
I need to have a total dollar amount referenced in a total field from the selection of multible items in a multi select list. The second column has the dollars. Is this possible?

Thanks in advance

Farnorth
 
some code like this should do it

Dim xaritem As Variant, intx As Integer
For Each varitem In Me.List3.ItemsSelected
intx = intx + Val(Me.List3.Column(1))
Next
Me.Text2 = intx
End Sub
 
Ignore the above Post, Sorry for the brain lapse

the proper code would be

Dim varitem As Variant, intx As Integer
intx = 0
For Each varitem In Me.List3.ItemsSelected
intx = intx + Val(Me.List3.Column(1, varitem))
Next varitem
Me.Text2 = intx

 
Thanks gol4! now I just need to figure out where and how to put the code. Dont be fooled by my choice of user "TechnicalUser" There was not a choice for semi Tec user LOL.

Thanks again.
 
Just paste it into the onclick event of your listbox

then change list3 to read the name of your listbox and change text2 to read the name of your textbox you want the total to show up in

if you have columns hidden then you may need to change
column(1, to which ever column you want to total

remember column(0) is the first then 1 2 3 etc

good luck
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top