R
Ray
I have recently been contracted to maintain an Access 97 database and I am
having problems accessing the HasData property of a subReport from a VB
standard module (not the reports module).
I can access the HasData property of the main report using:
"If Reports("rptname").HasData Then"
However I can't get a reference to the subreport via the Reports collection
as Access does not recognise that it is open.
I have attempted to enumerate the Controls collection and while this has a
SourceObject property it returns a string not an object.
I have also enumerated the database Containers collection to gain a
reference to the Document object for the report however this does not expose
the RecordSource property until you open the report in design mode.
Consequently you have to open the report in design mode, obtain the
RecordSource property, close the report then use something like DCount to
determine if the underlying table for the subreport contains any data. Of
course this flashes the report in design view on the screen.
Due to the way the code has been written it would require a major rewrite to
use the "NoData" event in the report to solve the problem - the same code is
used to format and display approximately 100 reports.
Does anyone know how I can access the the subreport via the report object so
that I can get at it's "HasData" property?
Thanks in advance,
Ray
having problems accessing the HasData property of a subReport from a VB
standard module (not the reports module).
I can access the HasData property of the main report using:
"If Reports("rptname").HasData Then"
However I can't get a reference to the subreport via the Reports collection
as Access does not recognise that it is open.
I have attempted to enumerate the Controls collection and while this has a
SourceObject property it returns a string not an object.
I have also enumerated the database Containers collection to gain a
reference to the Document object for the report however this does not expose
the RecordSource property until you open the report in design mode.
Consequently you have to open the report in design mode, obtain the
RecordSource property, close the report then use something like DCount to
determine if the underlying table for the subreport contains any data. Of
course this flashes the report in design view on the screen.
Due to the way the code has been written it would require a major rewrite to
use the "NoData" event in the report to solve the problem - the same code is
used to format and display approximately 100 reports.
Does anyone know how I can access the the subreport via the report object so
that I can get at it's "HasData" property?
Thanks in advance,
Ray