IIF not working

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi All,

I have a field in a report called "Penetration". That is calculated in the
underlying query. I also have an Unbound text box that I have named
"Penetration_Formula" whose control source is the following IIF Statement:

=IIf([Penetration]=0,"Unknown",[Penetration])

I am getting a #Error in the "Penetration_Formula" text box. Can anyone
tell me what I am doing wrong??

Sincerely,

Emma
 
Does the [Penetration] field view left or right aligned in the query
datasheet view? You may need to wrap it like:
=IIf(Val([Penetration])=0,"Unknown",[Penetration])

I trust you don't have a field in your report's record source named
Penetration_Formula.
 
Hi Duane,

Yes, the field view is right aligned and there are no other fields named
"Penetration_Formula" in my report's record source. I wrapped it as you
suggested and am still getting #Error. Any other suggestions?

Duane Hookom said:
Does the [Penetration] field view left or right aligned in the query
datasheet view? You may need to wrap it like:
=IIf(Val([Penetration])=0,"Unknown",[Penetration])

I trust you don't have a field in your report's record source named
Penetration_Formula.

--
Duane Hookom
MS Access MVP

Emma said:
Hi All,

I have a field in a report called "Penetration". That is calculated in
the
underlying query. I also have an Unbound text box that I have named
"Penetration_Formula" whose control source is the following IIF Statement:

=IIf([Penetration]=0,"Unknown",[Penetration])

I am getting a #Error in the "Penetration_Formula" text box. Can anyone
tell me what I am doing wrong??

Sincerely,

Emma
 
An alternative is to set the control source to just
[Penetration]
Then us the format property to display "Unknown" for 0 values. Search Help
on "Format Numeric" to find specifics.
--
Duane Hookom
MS Access MVP

Emma said:
Hi Duane,

Yes, the field view is right aligned and there are no other fields named
"Penetration_Formula" in my report's record source. I wrapped it as you
suggested and am still getting #Error. Any other suggestions?

Duane Hookom said:
Does the [Penetration] field view left or right aligned in the query
datasheet view? You may need to wrap it like:
=IIf(Val([Penetration])=0,"Unknown",[Penetration])

I trust you don't have a field in your report's record source named
Penetration_Formula.

--
Duane Hookom
MS Access MVP

Emma said:
Hi All,

I have a field in a report called "Penetration". That is calculated in
the
underlying query. I also have an Unbound text box that I have named
"Penetration_Formula" whose control source is the following IIF
Statement:

=IIf([Penetration]=0,"Unknown",[Penetration])

I am getting a #Error in the "Penetration_Formula" text box. Can
anyone
tell me what I am doing wrong??

Sincerely,

Emma
 
Back
Top