No, for a couple of reasons.
First is that all [Forms].[Form1].[ListBox].column(1) gives you is the value
in the second column of the selected row in the list box (assuming that it's
not set for MultiSelect).
Second is that values in list boxes are actually strings, even if they
strictly contain digits. (Okay, this isn't necessarily an issue: Access will
automatically do the conversion for you if things are set up properly).
If what you're saying is that you want the sum of all of the values in the
second column of a given listbox, try the following function:
Function AddListbox(WhichListbox As Control) As Long
Dim lngLoop As Long
Dim lngSum As Long
lngSum = 0
For lngLoop = 0 To (WhichListbox.ListCount - 1)
lngSum = lngSum + CLng(WhichListbox.Column(1, lngLoop))
Next lngLoop
AddListbox = lngSum
End Function
You can then set the ControlSource of the text box to
=AddListbox(Forms].[Form1].[ListBox])
--
Doug Steele, Microsoft Access MVP
(no e-mails, please!)
Gator said:
Can I put the following formula in a text box on a form to add numbers
listed
in a list box, column 2......=Sum[Forms].[Form1].[ListBox].column(1)