Strange...

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi!

I have a form with one column of the textboxes to write numerical values.
In the bottom of the form I have a textbox to sum the values of the this
column.
When I erase the value of first textbox, the value of the sum disappears.

Why, please?

Thanks in advance.
an
 
When you erase the value it becomes null. Adding a series if numbers where
one is null results in a null value.
Set the one you erased to 0 (zero)

Regards
Col
 
Hi!

I have a form with one column of the textboxes to write numerical values.

Is this a Continuous Form - where each "row" is another record? Or a
single form with textboxes just physically arrayed in vertical rows?
The answer will be different...
In the bottom of the form I have a textbox to sum the values of the this
column.

What is the Control Source property of this textbox?
When I erase the value of first textbox, the value of the sum disappears.

As suggested, it's probably because you have a NULL in the textbox.

Note that using a Form in such a way does not (and should not!!) store
the sum in any table. How are you using the data?

John W. Vinson[MVP]
 
Thank you for reply.

- Is a single form with textboxes just physically arrayed in vertical rows.

- The name of the first (top) textbox is FieldNameA,
Underneath of the previous one is FieldNameB
Underneath FieldNameC,
Underneath FieldNameN

- Control Source of sum textbox is:
=[FieldNameA]+[FieldNameB]+[FieldNameC]+[FieldNameN]

- Tha data are numerical data.

Thanks.
an
 
Thank you for reply.

- Is a single form with textboxes just physically arrayed in vertical rows.

- The name of the first (top) textbox is FieldNameA,
Underneath of the previous one is FieldNameB
Underneath FieldNameC,
Underneath FieldNameN

- Control Source of sum textbox is:
=[FieldNameA]+[FieldNameB]+[FieldNameC]+[FieldNameN]

To make this sum insensitive to nulls, use the NZ() - Null to Zero -
function. Set the Control Source to

=NZ([FieldNameA])+NZ([FieldNameB])+NZ([FieldNameC])+NZ([FieldNameN])

Be aware that this sum will not be (and should not be!) stored in any
table field, and that uf FieldNameA...N are fields in the Table upon
which your form is based, that your table structure is very likely
WRONG and in need of normalization.

John W. Vinson[MVP]
 
Thank you, JV

Exactly this.
Thanks for your help.
an

John Vinson said:
Thank you for reply.

- Is a single form with textboxes just physically arrayed in vertical rows.

- The name of the first (top) textbox is FieldNameA,
Underneath of the previous one is FieldNameB
Underneath FieldNameC,
Underneath FieldNameN

- Control Source of sum textbox is:
=[FieldNameA]+[FieldNameB]+[FieldNameC]+[FieldNameN]

To make this sum insensitive to nulls, use the NZ() - Null to Zero -
function. Set the Control Source to

=NZ([FieldNameA])+NZ([FieldNameB])+NZ([FieldNameC])+NZ([FieldNameN])

Be aware that this sum will not be (and should not be!) stored in any
table field, and that uf FieldNameA...N are fields in the Table upon
which your form is based, that your table structure is very likely
WRONG and in need of normalization.

John W. Vinson[MVP]
 
Back
Top