Can a report pass its own name?

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!
 
G

guido via AccessMonster.com

Call SetText(Me)

Public Sub SetText(CallingRpt As Report) is OK
 
P

Peter R. Fletcher

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
 

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