how to show show total in list box?

siamandm
5StarLounger
Posts: 1192
Joined: 01 May 2016, 09:58

how to show show total in list box?

Post by siamandm »

Hello All,

if I have a list box containing a column for expenditure, how do I calculate the total expenditure and show it in the list box?


Regards

User avatar
HansV
Administrator
Posts: 78236
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: how to show show total in list box?

Post by HansV »

You could create a Totals query that returns the sum of Expenditure.
Then create a Union query that combines the current source of the list box and the totals query.
Set the Row Source of the list box to this union query.

But wouldn't it be easier to display the total in a separate text box?
Best wishes,
Hans

siamandm
5StarLounger
Posts: 1192
Joined: 01 May 2016, 09:58

Re: how to show show total in list box?

Post by siamandm »

Thank you very much for the reply,

how to display the total in the text box, please?

Regards

User avatar
HansV
Administrator
Posts: 78236
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: how to show show total in list box?

Post by HansV »

Set its Control Source to

=DSum("Expenditure","NameOfTableOrQuery")

where NameOfTableOrQuery is the table or query that acts as Row Source of the list box.
Best wishes,
Hans

siamandm
5StarLounger
Posts: 1192
Joined: 01 May 2016, 09:58

Re: how to show show total in list box?

Post by siamandm »

thank you very much for the answer. I will try this