How to address subreports properties from main report

J

Joe

Hi all,

In Access 2007, I am using a main report which has three sub reports.
The main report shows some details per salesman, two of the subreports
are linked to the main report and show some details for this salesman,
too.

The third subreport shows a ranking of all salesmen, so this one is
not linked to the main report.

Now I would like every salesman to locate himself easily in the
ranking (i. e. the unlinked third report).

Therefore I would like to do the following:

In the report for the salesman A, his results in the ranking should
have a colored background (e. g. yellow), in the report for the
salesman B, B´s results should have the yellow background, etc..

My question is, how can I address the properties of a control in a sub
report, triggered by the event "OnOpen" from the main report.

So far, I have been trying this:

Reports("MainReport").Section(acDetail).Controls("SubReport").Controls
("FirstName").BackColor = RGB(255, 0, 0)

But got an error message that element is either not open or not
existent.
 
J

Joe

OK, I solved it. No one was interested here, so I dont go into details
with my solution. Only one hint if somebody runs into the same
problem: The VBA code for the formatting needs to be done in the
section where you actually want to modify the format. In my case this
is the section with the ranking for the salesmen. I compare every name
of the salesmen with the name of the salesmen of the master report.
When they are the same, I set the background to yellow, otherwise to
white.
 

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