using array to sum fields

  • Thread starter Thread starter gator
  • Start date Start date
G

gator

is an array an effective means to sum several fields into a txtbox on a form?
Can someone provide basic code?
 
is an array an effective means to sum several fields into a txtbox on a form?
 Can someone provide basic code?

you mean you already have your data in an array? More details please!

Arrays are pretty easy to deal with... and fairly lightweight, but a
bit more background info might be helpful... what kind of app?

you can just loop over the array and do the standard accumulator
thing... pretty much the same as looping over a recordset but much
lighter weight... and if you were gonna loop over a recordset, I'd say
use a totals query anyway...
 
gator said:
is an array an effective means to sum several fields into a txtbox on
a form? Can someone provide basic code?
In general, no. DSum or a query will be a *LOT* faster, even if you don't
count the time to load the array.
 
I have a form based on a table with about 30 txtboxes of numbers I want to
sum. Basically, what is the best way of going about it? I want to show the
sum in an unbound txtbox on the form
 
gator said:
I have a form based on a table with about 30 txtboxes of numbers I
want to sum. Basically, what is the best way of going about it? I
want to show the sum in an unbound txtbox on the form

"Piet Linden" wrote:

The same type of number in a field usually indicates a bad design.
If that is the case, and we would need more information,then using related
tables and a subform will make what you want to do easy.

You can mane the textboxes TB1, TB2...TB30 and use a for loop to sum them
or you could just use This textbox = TB1 + TB2 + ... +TB30
 
Back
Top