Don't show subreport IIF

G

Guest

Hi everyone! Using A02 on XP. Have a main report with 14 subreports nested
in the body. They each have a field "Is this section applicable?". If the
answer is "No" (0) I don't want the subreport to be visible. (Can't use the
OnNoData because of the Yes/No field - all the subreports have some data if
only in the one field.)

I tried this:

Private Sub Report_Open(Cancel As Integer)
If Me.ShortPlanYearApplies = 0 Then
Me.Detail.Visible = False
End If
End Sub

BUT, I get a run time error #2427, "You have entered an expression that has
no value." I've checked the field and it has "No", click into the field and
it is a zero. I've even changed it to "Yes". In both cases, I get the error
and the subreport does not appear on the main report.

Not sure if I'm putting this in the wrong place, using the wrong command
(OnOpen; Detail.Visible) or what. I'm sure it's something simple but...

I would really appreciate it if anyone can give me some help or advice on
this.

Thanks in advance for your time and help. LUV U GUYS!!!
 
M

Marshall Barton

Bonnie said:
Hi everyone! Using A02 on XP. Have a main report with 14 subreports nested
in the body. They each have a field "Is this section applicable?". If the
answer is "No" (0) I don't want the subreport to be visible. (Can't use the
OnNoData because of the Yes/No field - all the subreports have some data if
only in the one field.)

I tried this:

Private Sub Report_Open(Cancel As Integer)
If Me.ShortPlanYearApplies = 0 Then
Me.Detail.Visible = False
End If
End Sub

BUT, I get a run time error #2427, "You have entered an expression that has
no value."
[]

The Open event is too soon for this because the report's
data has not loaded yet. Use the Format event of the
section (Detail?) containing the subreport:

Me.subreportcontrol.Visible = Me.ShortPlanYearApplies
 
G

Guest

Marshall!!!!!! How are you????? Haven't seen your name in ages! How is the
land down under? Thank you SO MUCH for the quick, brilliant response! It
works perfectly. I had to read carefully to find where the OnFormat was but
your words contained what I needed, I just had to think about it. I really
appreciate your help!!!
--
Bonnie W. Anderson
Cincinnati, OH


Marshall Barton said:
Bonnie said:
Hi everyone! Using A02 on XP. Have a main report with 14 subreports nested
in the body. They each have a field "Is this section applicable?". If the
answer is "No" (0) I don't want the subreport to be visible. (Can't use the
OnNoData because of the Yes/No field - all the subreports have some data if
only in the one field.)

I tried this:

Private Sub Report_Open(Cancel As Integer)
If Me.ShortPlanYearApplies = 0 Then
Me.Detail.Visible = False
End If
End Sub

BUT, I get a run time error #2427, "You have entered an expression that has
no value."
[]

The Open event is too soon for this because the report's
data has not loaded yet. Use the Format event of the
section (Detail?) containing the subreport:

Me.subreportcontrol.Visible = Me.ShortPlanYearApplies
 
M

Marshall Barton

Bonnie said:
Marshall!!!!!! How are you????? Haven't seen your name in ages! How is the
land down under? Thank you SO MUCH for the quick, brilliant response! It
works perfectly. I had to read carefully to find where the OnFormat was but
your words contained what I needed, I just had to think about it. I really
appreciate your help!!!


Glad you could work it out, but "down under"??? Last I
looked, Chicago is north of Cincy ;-)
 
G

Guest

Sorry Marsh, must have crossed my wires. I do remember you have always been
very helpful and when I see your name on a post I know I'll be able to follow
what you are saying. You are a very good teacher. You take the time to
explain in a way that I can grasp. Thanks bunches for your time and
assistance!
 

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