Sum values in listbox?

B

Beetle

In one of my db's (A2003) I have a listbox that displays CurrentDate,
CompanyName, CountOfInvoices, SumOfInvoices. I'm wondering If there is
a way to display a sum of all the items in, for example, Column(2) and
(3) of the list box to get a grand total.

Right now I'm using a separate list box to display the values I want,
which works fine, so mostly I'm just curious. I couldn't figure out a
way to do it, but maybe I'm just being a meat head and overlooking
something.

Any ideas?

TIA

(is meat head one word or two?)
 
K

Klatuu

I have not tried this, but I had an idea that maybe using a Union query as
the row source of the list box. Union another query that would Sum the
values for your.
Just a spurious thought.
 
B

Beetle

Thanks Dave. I hadn't thought of that, but I'll try that when I get a chance.
It's not a big deal, but right now my form loads a little bit slower than I'd
like and I think it's because I have 4 list boxes, so I'm just looking at
alternatives.

As usual, there is nothing "meatheadish" about your advice.

meatheadish - that's a word right?
Note to self: find a dikshunairee ;-)
 
K

Klatuu

I don't know if this technique would work for you, but I had a similar
situation with a form where I needed 7 list boxes. It took 2 to 5 minutes to
open. So, took the row source off each list box, set its height to 0", and
put a command button just above each list box. In the click event of the
list box, I assigned the row source to the list box, set the height to what
is was in design view, and set the focus to it.
It loaded very fast and even the largest rowsource used a filtered query
that looked up values in a table with about 20,000 rows.
 
B

Beetle

Now that's a really good idea! I like that solution.

Again, thanks for your advice Dave. I appreciate it.
 

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