Summing Data Elements From Multiple Records

  • Thread starter maduckie123 via AccessMonster.com
  • Start date
M

maduckie123 via AccessMonster.com

Hi,

I'm looking for the best way to display a calculated value on a form that
will be the summation of multiple records. How do I specifiy to select all
the records -- that match a specific criteria -- and to render a single value
consisting of the sum of those values subtracted from a static number?

In Oracle, I would loop through each record and save the value (via a
"cursor") into a variable and then when no more records were found, the loop
would terminate and the value in the variable would be the value of all the
summed values. Is there a way to do this in VB/MSAccess?

Thanks in advance
 
D

Dirk Goldgar

maduckie123 via AccessMonster.com said:
Hi,

I'm looking for the best way to display a calculated value on a form that
will be the summation of multiple records. How do I specifiy to select
all
the records -- that match a specific criteria -- and to render a single
value
consisting of the sum of those values subtracted from a static number?

In Oracle, I would loop through each record and save the value (via a
"cursor") into a variable and then when no more records were found, the
loop
would terminate and the value in the variable would be the value of all
the
summed values. Is there a way to do this in VB/MSAccess?


I can't be sure, but it sounds like the DSum() function may suit your needs.
Yuo can set the control source of a text box to a DSum() expression, as in
this example:

=DSum("Amount", "tblInvoices", "Unpaid=True")
 
J

Jeff Boyce

It all starts with the data. Please describe how your data is structured.
"How to" do something with it depends on how your tables have it organized.

Regards

Jeff Boyce
Microsoft Office/Access MVP
 

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