Accessing master report properties from a sub-report

M

Mark Erickson

Hi, new here so HI!

I have a sub-report that is used by several master reports. I would
like to hide (.visible = False) one of the text controls on the
sub-report depending on which master report is running it. Has anyone
got any idea how to do this?

Thanks
Mark


--
 
M

Mark Erickson

Hi,

I worked it out, the following does what I wanted:


If Report.Parent.Name <> "ReportName" Then
txtControl.visible = False
End If

Thanks anyway,
Mark
 
M

Marshall Barton

Mark said:
I worked it out, the following does what I wanted:


If Report.Parent.Name <> "ReportName" Then
txtControl.visible = False
End If


That's the right idea, but it is more common to use Me
instead of Report. Me is explicitly the object containing
the code. Report is a property that in the way you are
using it defaults to the object containing the code. You
end up at the same place, but Report is a less direct way of
getting there.
 
M

Mark Erickson

Hi,

Out of interest, is there a performance hit using Report rather than Me?

I've changed it to Me by the way.

Thanks
Mark
 
M

Marshall Barton

Mark said:
Out of interest, is there a performance hit using Report rather than Me?


Probably some performace difference. However, I think(?) it
would be too small to notice unless you use it all over the
place in a loop with a large number of iterations.
 

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