Referencing SubReport from Report

  • Thread starter Thread starter J9
  • Start date Start date
J

J9

On the detail format event of the Main report I would
like to know if there is going to be data on the
Subreport that will print out so that I can show some
controls on the parent report. If there is no data that
will print out I will hide these same controls.

I want to be able to reference the subreport without
having to execute an sql statement to determine if values
exist (ie. something like if Me.SR.HasData then....).
On compile, I am not being gigged for that statement but
on report run I get the message "Object doesn't support
this property or method"

Is there a way then to reference the Subreport to check
for data without creating an sql statement, setting the
rs to the sql, and checking for rs.eof?

Thanks,
J9
 
Reports have a HasData property.

The report in the subreport control like this:
=IIf([NameOfYourSubreportControlHere].[Report].[HasData], "Yep", "Nah")
 
J9 said:
On the detail format event of the Main report I would
like to know if there is going to be data on the
Subreport that will print out so that I can show some
controls on the parent report. If there is no data that
will print out I will hide these same controls.

I want to be able to reference the subreport without
having to execute an sql statement to determine if values
exist (ie. something like if Me.SR.HasData then....).
On compile, I am not being gigged for that statement but
on report run I get the message "Object doesn't support
this property or method"

Is there a way then to reference the Subreport to check
for data without creating an sql statement, setting the
rs to the sql, and checking for rs.eof?


There's a property just for this kind of thing:

If Me.subreport.Report.HasData Then
Me.somecontrol.Visible = False
. . .
 
Hi,

The syntax is

IF [SubRpt].Report.HasData=True THEN
' Do something
END IF

See: ACC2000: "#ERROR" Message When Referencing Subreport Controls
http://support.microsoft.com/default.aspx?scid=kb;en-us;208718


I hope this helps! If you have additional questions on this topic, please
respond back to this posting.


Regards,

Eric Butts
Microsoft Access Support
(e-mail address removed)
"Microsoft Security Announcement: Have you installed the patch for
Microsoft Security Bulletin MS03-026? If not Microsoft strongly advises
you to review the information at the following link regarding Microsoft
Security Bulletin MS03-026
<http://www.microsoft.com/security/security_bulletins/ms03-026.asp> and/or
to visit Windows Update at <http://windowsupdate.microsoft.com/> to install
the patch. Running the SCAN program from the Windows Update site will help
to insure you are current with all security patches, not just MS03-026."

This posting is provided "AS IS" with no warranties, and confers no rights


--------------------
| Content-Class: urn:content-classes:message
| From: "J9" <[email protected]>
| Sender: "J9" <[email protected]>
| Subject: Referencing SubReport from Report
| Date: Mon, 7 Jun 2004 07:36:14 -0700
| Lines: 19
| Message-ID: <[email protected]>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="iso-8859-1"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
| Thread-Index: AcRMnMja67NbTPy9TFu1oAuXh92bdQ==
| Newsgroups: microsoft.public.access.reports
| Path: cpmsftngxa10.phx.gbl
| Xref: cpmsftngxa10.phx.gbl microsoft.public.access.reports:139935
| NNTP-Posting-Host: tk2msftngxa13.phx.gbl 10.40.1.165
| X-Tomcat-NG: microsoft.public.access.reports
|
| On the detail format event of the Main report I would
| like to know if there is going to be data on the
| Subreport that will print out so that I can show some
| controls on the parent report. If there is no data that
| will print out I will hide these same controls.
|
| I want to be able to reference the subreport without
| having to execute an sql statement to determine if values
| exist (ie. something like if Me.SR.HasData then....).
| On compile, I am not being gigged for that statement but
| on report run I get the message "Object doesn't support
| this property or method"
|
| Is there a way then to reference the Subreport to check
| for data without creating an sql statement, setting the
| rs to the sql, and checking for rs.eof?
|
| Thanks,
| J9
|
 
Back
Top