#Error in report with IIf statement

  • Thread starter Thread starter BUGSWorker
  • Start date Start date
B

BUGSWorker

I am working with a report, and trying to get it to display inform from a
query. There query has a field for Area of Study with Any Other Curriculum
as an option. There is then also an Other field, where the area of study can
be further expounded upon if it is not within the available curriculum. I am
trying to display the information from this query in a report that has the
area of study shown. I was wondering how I can show the Other field when the
Area of Study field states Any Other Curriculum. What I currently have is

=IIf([AreaOfStudy]="Any Other Curriculum",[Other],[AreaOfStudy])

but this is giving me #Error for every Area of Study.

Thanks for the help!

Steve
 
I am working with a report, and trying to get it to display inform from a
query. There query has a field for Area of Study with Any Other Curriculum
as an option. There is then also an Other field, where the area of study can
be further expounded upon if it is not within the available curriculum. I am
trying to display the information from this query in a report that has the
area of study shown. I was wondering how I can show the Other field when the
Area of Study field states Any Other Curriculum. What I currently have is

=IIf([AreaOfStudy]="Any Other Curriculum",[Other],[AreaOfStudy])

but this is giving me #Error for every Area of Study.

Thanks for the help!

Steve

Make sure the name of this control is not "AreaOfStudy".
 
BUGSWorker said:
I am working with a report, and trying to get it to display inform from a
query. There query has a field for Area of Study with Any Other Curriculum
as an option. There is then also an Other field, where the area of study can
be further expounded upon if it is not within the available curriculum. I am
trying to display the information from this query in a report that has the
area of study shown. I was wondering how I can show the Other field when the
Area of Study field states Any Other Curriculum. What I currently have is

=IIf([AreaOfStudy]="Any Other Curriculum",[Other],[AreaOfStudy])

but this is giving me #Error for every Area of Study.

Thanks for the help!

Steve

You can do this a couple of ways. You can create a field in your query such
as:

IIf([AreaOfStudy]="Any Other Curriculum",[Other],[AreaOfStudy]) AS AOS

And display the AOS field on your report.


Alternatively, you can tinker with the visible property of the fields in
the OnFormat event of the report. :

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If Me.AreaOfStudy = "Any Other Curriculum" Then
Me.Other.Visible = True

Else

Me.Other.Visible = False
End If
End Sub
 
Back
Top