How is a report object's property accessed ?

G

Guest

How is a report object's property accessed in programmatically ? I tried
Reports![Report Name]!objectName.property but it's not recognized.

Thanks in advance.
 
F

fredg

How is a report object's property accessed in programmatically ? I tried
Reports![Report Name]!objectName.property but it's not recognized.

Thanks in advance.

I don't suppose you would care to share with us the actual property
you wish to access, and what you wish to do with that information once
you have it.
Your Access Version number would also be helpful.
 
G

George Nicholson

...not recognized...
Not sure what that means, since "not recognized" isn't a term that Access
uses (afaik), and relying on our psychic powers to read your mind isn't
always productive. *Specific* error messages (and actual code samples) are
always good.

So, smart-ass answers aside (sorry) and guessing that you are making the
most common error:

Report![Report Name].ControlOrSectionName.ControlOrSectionProperty

should work *if* the report is actually open. (The Reports collection is
comprised only of Reports that are currently open).


HTH, if not post back with additional detail.
 
G

Guest

In the event that there's no data or records pulled, the report would show
some literal "#Error" for fields that have computation like textbox with
datesource of =Sum(fields). I want to move a space to that textbox to
suppress that "#Error" text in the report.

For Fredg, my access version is 2003.

George Nicholson said:
...not recognized...
Not sure what that means, since "not recognized" isn't a term that Access
uses (afaik), and relying on our psychic powers to read your mind isn't
always productive. *Specific* error messages (and actual code samples) are
always good.

So, smart-ass answers aside (sorry) and guessing that you are making the
most common error:

Report![Report Name].ControlOrSectionName.ControlOrSectionProperty

should work *if* the report is actually open. (The Reports collection is
comprised only of Reports that are currently open).


HTH, if not post back with additional detail.



JJ said:
How is a report object's property accessed in programmatically ? I tried
Reports![Report Name]!objectName.property but it's not recognized.

Thanks in advance.
 
F

fredg

In the event that there's no data or records pulled, the report would show
some literal "#Error" for fields that have computation like textbox with
datesource of =Sum(fields). I want to move a space to that textbox to
suppress that "#Error" text in the report.

For Fredg, my access version is 2003.

George Nicholson said:
...not recognized...
Not sure what that means, since "not recognized" isn't a term that Access
uses (afaik), and relying on our psychic powers to read your mind isn't
always productive. *Specific* error messages (and actual code samples) are
always good.

So, smart-ass answers aside (sorry) and guessing that you are making the
most common error:

Report![Report Name].ControlOrSectionName.ControlOrSectionProperty

should work *if* the report is actually open. (The Reports collection is
comprised only of Reports that are currently open).

HTH, if not post back with additional detail.

JJ said:
How is a report object's property accessed in programmatically ? I tried
Reports![Report Name]!objectName.property but it's not recognized.

Thanks in advance.

You don't need to address the report control as you suggested.

To suppress displaying or printing the entire report if it has no
data, use the report's OnNoData event:

MsgBox "There were no records returned for this report."
Cancel = True.

The message will display, then the entire report will be canceled.

If you wish instead to print the report with just a brief message on
the paper, and hide the #error controls, add a label to the report.
Set it's caption to "No data for this report". Make this label Not
Visible.

Then code the Report's OnNoData event:
Dim C as Control
For each C in Me.Controls
C.Visible = Not C.Visible
Next

All the controls will be not visible, except for the label you just
added.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top