Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calculating totals in continous form

Status
Not open for further replies.

Moss100

Technical User
Aug 10, 2004
579
0
16
GB
Hello all,

I have a continuous form with a textbox called CONFIRMED_SUM

The textbox is bound to the field ATTENDEE_CONFIRMED

In the footer of the form I have a textbox with the control source set as :

Sum([attendee_confirmed])

This gives a total for the form with is fine.

The problem arises when there are no records in the form. If there are no records I would like the calculated text box to state 0

I think I need to use NZ in someway - but can't figure out how.

Any help much appreciated.

Regards

Mark
 
Nz(Sum([attendee_confirmed]), 0)

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Thanks, but this only works when records are present - if there are no records on the form the text box remains empty.

Any further ideas?

Regards

Mark
 
Set a DefaultValue ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Set a DefaultValue ? - No this doesn't work either - very frustrating!
 
Perhaps a format like this ?
0;(0);0;0

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
The format solution kind of works, but only when the control has focus.

The other code does not work until the form has records in it.

The problem seems to be setting the text box whilst there are no records in the form - it's not records present but with null values, but rather no records present.

Funny how seemingly simple things are sometimes the hardest to solve!!

Thanks do far everyone.
 
Funny how seemingly simple things are sometimes the hardest to solve!!
You know what ? I wonder what is the problem to have an empty textbox when where is nothing to display ...
 
I'm using the form as a sub form.

The totals work fine once records are inserted, but if there are no records I just wanted the text box to display 0 instead of being empty.



Regards mark.
 
Thanks for the interest - the form (although used as a subform) reacts the same when just used as a form.

I have programmed around it by using a record count field that displays 0 when there are no records - but I would still be interested to know whether it is possible to set a textbox to display 0 when used to sum on a contuous form.

Thank you very much for all your suggestions anyhow.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top