#Error if there is nothing to sum

Becca

Registered User.
Local time
Today, 04:20
Joined
Dec 12, 2001
Messages
58
Hi
I have a query which runs to select the feilds shown on a subform. The query results then are used to calculate the sum of the records displayed in the subform.
My problem is that when I am creating a brand new entry in the sub form, prior to any entries it shows #Error. Not a huge problem, but I have some wisecracking users who will make a mouthful about it.
Anyone know of a useful way to hide the #error. I have tried the NZ function, but to no avail. Default values are set to 0 but it doesn't do any good.

Help is much appreciated, as I am learning access through trial and error
 
I can't duplicate your problem in Access 97; the total field on the subform remains blank (the control source is =Sum([FieldName]).

However, if I reference that value on the main form, I do then get the #Error value showing when there are no records on the subform.

I've found that this works on the main form, maybe this will work for you:

=IIf([subfrmName].[Form].[CurrentRecord]>0,[subfrmName].[Form]![txtTotal],0)

Simon.
 
BEAUTIFUL
I could absolutely kiss you, but the moderators would frown on that I think. That solved my problem.

Thanks a pile
 

Users who are viewing this thread

Back
Top Bottom