Re: Nz Function in Control Source
- From: colin spalding <colin.mardell@xxxxxxxxxxxxxxx>
- Date: Fri, 30 May 2008 10:31:34 -0700 (PDT)
On May 30, 3:50 pm, "paii, Ron" <n...@xxxxxx> wrote:
"colin spalding" <colin.mard...@xxxxxxxxxxxxxxx> wrote in message
news:9240f596-c0c7-476b-8a46-d4d127d44dfe@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Access 2003
I subform which lists financial transactions for a client in the main
form, which i total in a textbox named "txtTotalPremium" in the
subform footer with the Control Source "=Sum([PremiumGBP])"; without
quotations of course. This works fine until the subform has no
records to return in which case textbox is blank. That would be fine
except I need to use the figure in another text box on the main form
as part of another calculation. I have tried hundred different
combination of the Nz and IIf functions all to no avail. it seems to
me that the straight forward "=Nz(Sum([PremiumGBP]),0)" should do it,
but unfortunately not; whatever I do I get a blank textbox and
"#Error" and/or #Name?" in the mainform textbox, Where do I go from
here?
=Sum(NZ([PremiumGBP],0))
NZ needs to be inside the sum otherwise you may try to sum a NULL.
You get #Name when subform is empty because [PremiumGBP] field does not
exist. You will need to check for a no data condition in the subform.
Is [PremiumGBP] a numeric field? If not you will need
=Sum(iif(IsNumeric(NZ([PremiumGBP],0)),[PremiumGBP],0).
Thanks Ron
Yes the field [PremiumGBP] definitely exists and yes it is numeric
(assuming Currency counts as numeric). I have tried both solutions
you suggest but still no joy.
.
- Follow-Ups:
- Re: Nz Function in Control Source
- From: paii, Ron
- Re: Nz Function in Control Source
- References:
- Nz Function in Control Source
- From: colin spalding
- Re: Nz Function in Control Source
- From: paii, Ron
- Nz Function in Control Source
- Prev by Date: Re: VBA/Access Global Search&Replace from LUT
- Next by Date: Re: Access export to excel bug
- Previous by thread: Re: Nz Function in Control Source
- Next by thread: Re: Nz Function in Control Source
- Index(es):
Relevant Pages
|
|