Hi,
I do have a question how to make a sum in textbox on form with listbox by a column,
in these thread found an advice but its not working for me somehow
listbox name is lstOrders, column for which sum is needed is 6, textboxname - tboListSum
in source code of textbox - tboListSum=sumListboxColumn([lstOrders];6)
and the function is the same as in old thread -
Public Function sumListboxColumn(lstbox As Control, columnNumber As Integer) As Integer
On Error GoTo Err_sumListboxColumn
Dim counter As Integer
Dim total As Integer
total = 0
For counter = 0 To lstbox.ListCount - 1
total = total + lstbox.Column(columnNumber, counter)
Next counter
Exit_sumListboxColumn:
sumListboxColumn = total
Exit Function
Err_sumListboxColumn:
MsgBox Err.Description
Resume Exit_sumListboxColumn
End Function
Can anyone explain me why its not working? got a #Name? error...
I do have a question how to make a sum in textbox on form with listbox by a column,
in these thread found an advice but its not working for me somehow
listbox name is lstOrders, column for which sum is needed is 6, textboxname - tboListSum
in source code of textbox - tboListSum=sumListboxColumn([lstOrders];6)
and the function is the same as in old thread -
Public Function sumListboxColumn(lstbox As Control, columnNumber As Integer) As Integer
On Error GoTo Err_sumListboxColumn
Dim counter As Integer
Dim total As Integer
total = 0
For counter = 0 To lstbox.ListCount - 1
total = total + lstbox.Column(columnNumber, counter)
Next counter
Exit_sumListboxColumn:
sumListboxColumn = total
Exit Function
Err_sumListboxColumn:
MsgBox Err.Description
Resume Exit_sumListboxColumn
End Function
Can anyone explain me why its not working? got a #Name? error...