Can a report pass its own name?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have several similar reports which use the same procedure. I want to move
the procedure to a General Module and call it from the report.

Two questions:
The procedure will need to know the name of the calling report. I can pass
the argument like this: Call SetText(Report!SpecRpt01) , Call
SetText(Report!SpecRpt02) , etc... But is there a way with one piece of code
for the report to insert its own name into the Call?

Also, what does the called procedure need to have as its argument
specification? Will Public Sub SetText(CallingRpt As Report) do it?

Thanks!
 
Call MyFunction (Me.Name,....) will pass the name as a String. If you
want to access controls on the the Report from the Function, you can
pass a reference to it thus: Call MyFunction (Me,....). If the latter
case, the argument is declared as "Report".

I have several similar reports which use the same procedure. I want to move
the procedure to a General Module and call it from the report.

Two questions:
The procedure will need to know the name of the calling report. I can pass
the argument like this: Call SetText(Report!SpecRpt01) , Call
SetText(Report!SpecRpt02) , etc... But is there a way with one piece of code
for the report to insert its own name into the Call?

Also, what does the called procedure need to have as its argument
specification? Will Public Sub SetText(CallingRpt As Report) do it?

Thanks!

Please respond to the Newsgroup, so that others may benefit from the exchange.
Peter R. Fletcher
 
Back
Top