Calculated expression based on another field value

G

Guest

My report source is a query where [Defect] is a number and [DefectDesc] is
text.

I want the value of the [defect] field to print a value based on the content
of [DefecDesc] on the detail line

My expression in the [Defect] text box is:
=IIf([DefectDesc]="tear",0,[Defect])
This field prints ERRORif the expressiion is evaluated False, but does print
0 if True.

I am also using a control footer with sum([Defect]), as well, if that
figures in your answer.

Can anyone help.

TIA,
Lee
 
G

Guest

Thanks for the quick response, Duane.

When I changed the name of the control to "NumberofDefects" the detail line
worked perfectly. Now, however, the groupl footer expression has been
changed to =sum([NumberofDefects]) which is not recognized (causes an "enter
parameter value") and does not print at all.

What's my next step?

Thanks again,
Lee


Duane Hookom said:
Make sure the name of the control is not the name of a field.

--
Duane Hookom
MS Access MVP
--

Lee Hunter said:
My report source is a query where [Defect] is a number and [DefectDesc] is
text.

I want the value of the [defect] field to print a value based on the
content
of [DefecDesc] on the detail line

My expression in the [Defect] text box is:
=IIf([DefectDesc]="tear",0,[Defect])
This field prints ERRORif the expressiion is evaluated False, but does
print
0 if True.

I am also using a control footer with sum([Defect]), as well, if that
figures in your answer.

Can anyone help.

TIA,
Lee
 
D

Duane Hookom

You can't sum a control. Try:

=Sum(IIf([DefectDesc]="tear",0,[Defect]))

--
Duane Hookom
MS Access MVP
--

Lee Hunter said:
Thanks for the quick response, Duane.

When I changed the name of the control to "NumberofDefects" the detail
line
worked perfectly. Now, however, the groupl footer expression has been
changed to =sum([NumberofDefects]) which is not recognized (causes an
"enter
parameter value") and does not print at all.

What's my next step?

Thanks again,
Lee


Duane Hookom said:
Make sure the name of the control is not the name of a field.

--
Duane Hookom
MS Access MVP
--

Lee Hunter said:
My report source is a query where [Defect] is a number and [DefectDesc]
is
text.

I want the value of the [defect] field to print a value based on the
content
of [DefecDesc] on the detail line

My expression in the [Defect] text box is:
=IIf([DefectDesc]="tear",0,[Defect])
This field prints ERRORif the expressiion is evaluated False, but does
print
0 if True.

I am also using a control footer with sum([Defect]), as well, if that
figures in your answer.

Can anyone help.

TIA,
Lee
 
G

Guest

Thanks for the help Duane.

I ended up modifying the query to do the calculations there.

Lee
Duane Hookom said:
You can't sum a control. Try:

=Sum(IIf([DefectDesc]="tear",0,[Defect]))

--
Duane Hookom
MS Access MVP
--

Lee Hunter said:
Thanks for the quick response, Duane.

When I changed the name of the control to "NumberofDefects" the detail
line
worked perfectly. Now, however, the groupl footer expression has been
changed to =sum([NumberofDefects]) which is not recognized (causes an
"enter
parameter value") and does not print at all.

What's my next step?

Thanks again,
Lee


Duane Hookom said:
Make sure the name of the control is not the name of a field.

--
Duane Hookom
MS Access MVP
--

My report source is a query where [Defect] is a number and [DefectDesc]
is
text.

I want the value of the [defect] field to print a value based on the
content
of [DefecDesc] on the detail line

My expression in the [Defect] text box is:
=IIf([DefectDesc]="tear",0,[Defect])
This field prints ERRORif the expressiion is evaluated False, but does
print
0 if True.

I am also using a control footer with sum([Defect]), as well, if that
figures in your answer.

Can anyone help.

TIA,
Lee
 

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