Sum of Field in Listbox

C

CK

I have a listbox with 3 columns and I have added an control that will store
the sum of the numbers in column 3 of the listbox. I tried something like
this in the default value of the control but it doesn't seem to work:

= Sum(Var(listboxname).Column(2))

Is this the correct way of doing it? Thanks.
ck
 
S

Steve Schapel

CK,

As far as I know, you won't be able to do this by reference to the
listbox itself. You will need to refer to the query that the listbox's
Row Source comes from. One option would be to make a Continuous View
subform based on this query, and you will be able to put a calculated
control in the footer of this form to get the Sum. Another would be to
use a domain aggregate function in your existing textbox, like this...
=DSum("[YourThirdField]","YourQuery")
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top