467,151 Members | 1,164 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,151 developers. It's quick & easy.

Report/Subreport Question

A97

I have a report/sub-report setup and for some records in the main report,
the sub-report is blank. I want to set the height of the sub-report to zero
where it is blank. I've set all the "Can shrink" properties to 'yes' but
I'm having trouble with the syntax referencing the text boxes on the sub-
report.

I get run-time error 2445 (you entered an expression that has an invalid
reference to the property form/report) on the first line of this in the
report's On open event:

If IsNull(Reports!rptECR!srptECR!txtID) Then
Me.srptECR.Height = 0
Me.lblSub.Height = 0
Me.GroupHeader2.Height = 300
Else
Me.srptECR.Height = 240
Me.lblSub.Height = 240
Me.GroupHeader2.Height = 540
End If

I've tried using the "Me" method to reference sub-form objects too but with
similar results.

Any suggestions greatfully received.

Keith.
Nov 13 '05 #1
  • viewed: 1982
Share:
2 Replies
Hi Keith

You cannot use the Report_Open of the subreport like that, but you should
not need to. Further, you cannot refer to the text boxes on a subreport that
has no data: they actually don't exist.

If the subreport has no records, nothing is printed. If the subreport
control's CanShrink is set to Yes, and the main report's (Detail?) section's
CanShrink is also Yes, that should be all you need.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Keith Wilby" <ke*********@AwayWithYerCrap.com> wrote in message
news:Xn************************@10.15.188.42...
A97

I have a report/sub-report setup and for some records in the main report,
the sub-report is blank. I want to set the height of the sub-report to
zero
where it is blank. I've set all the "Can shrink" properties to 'yes' but
I'm having trouble with the syntax referencing the text boxes on the sub-
report.

I get run-time error 2445 (you entered an expression that has an invalid
reference to the property form/report) on the first line of this in the
report's On open event:

If IsNull(Reports!rptECR!srptECR!txtID) Then
Me.srptECR.Height = 0
Me.lblSub.Height = 0
Me.GroupHeader2.Height = 300
Else
Me.srptECR.Height = 240
Me.lblSub.Height = 240
Me.GroupHeader2.Height = 540
End If

I've tried using the "Me" method to reference sub-form objects too but
with
similar results.

Any suggestions greatfully received.

Keith.

Nov 13 '05 #2
"Allen Browne" <Al*********@SeeSig.Invalid> wrote:
If the subreport has no records, nothing is printed. If the subreport
control's CanShrink is set to Yes, and the main report's (Detail?)
section's CanShrink is also Yes, that should be all you need.


That's worked a treat, many thanks Allen.
Nov 13 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by David B | last post: by
7 posts views Thread by Ellen Manning | last post: by
1 post views Thread by shaqattack1992-newsgroups@yahoo.com | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.