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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sum of column in list box

Status
Not open for further replies.

knighty03

Technical User
Aug 12, 2003
32
GB
I have a list box on a form and it contains a value column. I need to extract the Sum of this column into an unbound field but i keep getting an error no matter what I try. Can this be done?
 
Put this in your FormCurrent() event:

Dim ctlList
Dim MySum as Long ' Or Double
Set ctlList=Me.YourListBox
MySum=0
For Each Lmnt In ctList.Columns(YourColumnIndex
MySum=MySum + CLng(ctlList.Columns(Lmnt))
Next

Me.YourUnboundSumField=MySum

This should do it.:)
Best wishes,
MakeItSo

Andreas Galambos
EDP / Technical Support Specialist
Bowne Global Solutions Wuppertal, Germany
(andreas.galambos@bowneglobal.de)
HP:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top