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.