By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,705 Members | 1,891 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,705 IT Pros & Developers. It's quick & easy.

Report/Subreport Question

P: n/a
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
Share this Question
Share on Google+
2 Replies


P: n/a
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

P: n/a
"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.