how do i sum the result of an expression in a field

G

Guest

Im not sure if im asking this correctly so i hope it makes sense !

In a report footer (one of several in the report), i have the following text
boxes with the expression =Sum(IIf([PREGNANCY OUTCOME]='NEGATIVE URINE
TEST',1,Null)), to give a total number for that specified expression
parameter.

I have about 9 of these, with the sum expression set-up to count various
parameters that may be present in the 'pregancy outcome' field in the
underlying query.

I want to add together all but one or two of the results of these
expressions and disply this in the same group footer.

Ive tried = Sum ( [TOTAL ONGOING MONTH] + [TOTAL SINGLE MONTH] + [TOTAL
TWINS MONTH] + [TOTAL TRIPLETS MONTH] + [TOTAL BIOCHEM MONTH] + [TOTAL
ECTOPIC MONTH] + [TOTAL MISC 12 MONTH] + [TOTAL MC6 MONTH] )

Which i thought would work, seemed to make sense.

But when i run the report, i get asked for the parameter value for the TOTAL
ONGOING MONTH etc.

Where am i going wrong !
 
G

Guest

Try taking out the word Sum, i.e., = [TOTAL ONGOING MONTH] + [TOTAL SINGLE
MONTH] + [TOTAL TWINS MONTH] + [TOTAL TRIPLETS MONTH] + [TOTAL BIOCHEM MONTH]
+ [TOTAL ECTOPIC MONTH] + [TOTAL MISC 12 MONTH] + [TOTAL MC6 MONTH]
 
G

Guest

i no longer get asked for the parameter values, but i dont get anything in
the actual field where i would expect the anser to be.

Its defined as a general number

Ken Warthen said:
Try taking out the word Sum, i.e., = [TOTAL ONGOING MONTH] + [TOTAL SINGLE
MONTH] + [TOTAL TWINS MONTH] + [TOTAL TRIPLETS MONTH] + [TOTAL BIOCHEM MONTH]
+ [TOTAL ECTOPIC MONTH] + [TOTAL MISC 12 MONTH] + [TOTAL MC6 MONTH]



Philip said:
Im not sure if im asking this correctly so i hope it makes sense !

In a report footer (one of several in the report), i have the following text
boxes with the expression =Sum(IIf([PREGNANCY OUTCOME]='NEGATIVE URINE
TEST',1,Null)), to give a total number for that specified expression
parameter.

I have about 9 of these, with the sum expression set-up to count various
parameters that may be present in the 'pregancy outcome' field in the
underlying query.

I want to add together all but one or two of the results of these
expressions and disply this in the same group footer.

Ive tried = Sum ( [TOTAL ONGOING MONTH] + [TOTAL SINGLE MONTH] + [TOTAL
TWINS MONTH] + [TOTAL TRIPLETS MONTH] + [TOTAL BIOCHEM MONTH] + [TOTAL
ECTOPIC MONTH] + [TOTAL MISC 12 MONTH] + [TOTAL MC6 MONTH] )

Which i thought would work, seemed to make sense.

But when i run the report, i get asked for the parameter value for the TOTAL
ONGOING MONTH etc.

Where am i going wrong !
 
G

Guest

Hi Philip.
for one you could use:
=Sum (Abs([Pregnancy Outcome]="Negative Urine Test"))
instead of your IIF statement.
Then you can use a similar statement with the like function or using <> to
exclude the one or two like:
=Sum (Abs([Pregnancy Outcome]<> "Condition one" .AND. [Pregnancy Outcome]<>
"Condition two"))
Hope this helps.
Fons
 
G

Guest

Thanks for thatt, tried it but now im getting strange results.

Chaning the Abs for IIf worked fine.

I dont understand the Like function or the <> (i think its a logical
expression).

Access accpets the formula, but it results in unusual values.

When i should get a positive value, i get 0. When i should get zero, i get
2 or three.

Thanks for suggesting it anyway, looks like ill have to ask at the
univeristy.

Philip

Fons Ponsioen said:
Hi Philip.
for one you could use:
=Sum (Abs([Pregnancy Outcome]="Negative Urine Test"))
instead of your IIF statement.
Then you can use a similar statement with the like function or using <> to
exclude the one or two like:
=Sum (Abs([Pregnancy Outcome]<> "Condition one" .AND. [Pregnancy Outcome]<>
"Condition two"))
Hope this helps.
Fons

Philip said:
Im not sure if im asking this correctly so i hope it makes sense !

In a report footer (one of several in the report), i have the following text
boxes with the expression =Sum(IIf([PREGNANCY OUTCOME]='NEGATIVE URINE
TEST',1,Null)), to give a total number for that specified expression
parameter.

I have about 9 of these, with the sum expression set-up to count various
parameters that may be present in the 'pregancy outcome' field in the
underlying query.

I want to add together all but one or two of the results of these
expressions and disply this in the same group footer.

Ive tried = Sum ( [TOTAL ONGOING MONTH] + [TOTAL SINGLE MONTH] + [TOTAL
TWINS MONTH] + [TOTAL TRIPLETS MONTH] + [TOTAL BIOCHEM MONTH] + [TOTAL
ECTOPIC MONTH] + [TOTAL MISC 12 MONTH] + [TOTAL MC6 MONTH] )

Which i thought would work, seemed to make sense.

But when i run the report, i get asked for the parameter value for the TOTAL
ONGOING MONTH etc.

Where am i going wrong !
 
G

Guest

Philip, if you post the conditions you are trying to exclude I can give you a
more specific formula.
Fons

Philip said:
Thanks for thatt, tried it but now im getting strange results.

Chaning the Abs for IIf worked fine.

I dont understand the Like function or the <> (i think its a logical
expression).

Access accpets the formula, but it results in unusual values.

When i should get a positive value, i get 0. When i should get zero, i get
2 or three.

Thanks for suggesting it anyway, looks like ill have to ask at the
univeristy.

Philip

Fons Ponsioen said:
Hi Philip.
for one you could use:
=Sum (Abs([Pregnancy Outcome]="Negative Urine Test"))
instead of your IIF statement.
Then you can use a similar statement with the like function or using <> to
exclude the one or two like:
=Sum (Abs([Pregnancy Outcome]<> "Condition one" .AND. [Pregnancy Outcome]<>
"Condition two"))
Hope this helps.
Fons

Philip said:
Im not sure if im asking this correctly so i hope it makes sense !

In a report footer (one of several in the report), i have the following text
boxes with the expression =Sum(IIf([PREGNANCY OUTCOME]='NEGATIVE URINE
TEST',1,Null)), to give a total number for that specified expression
parameter.

I have about 9 of these, with the sum expression set-up to count various
parameters that may be present in the 'pregancy outcome' field in the
underlying query.

I want to add together all but one or two of the results of these
expressions and disply this in the same group footer.

Ive tried = Sum ( [TOTAL ONGOING MONTH] + [TOTAL SINGLE MONTH] + [TOTAL
TWINS MONTH] + [TOTAL TRIPLETS MONTH] + [TOTAL BIOCHEM MONTH] + [TOTAL
ECTOPIC MONTH] + [TOTAL MISC 12 MONTH] + [TOTAL MC6 MONTH] )

Which i thought would work, seemed to make sense.

But when i run the report, i get asked for the parameter value for the TOTAL
ONGOING MONTH etc.

Where am i going wrong !
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top