Report Control Reference

  • Thread starter Thread starter scott
  • Start date Start date
S

scott

In a general module, I can get the name of the currently opened report with
code below. I have several reports that I run my code on and I'm trying to
find the correct syntax to reference a control on each report from the
general module. The control will be named the same on each report, so I
tried using rptCurrentReport.myControlName, but I get an error.

Is there a way to reference a control this way?

CODE **********

Set rptCurrentReport = Screen.ActiveReport
sReport = CStr(rptCurrentReport.Name)
 
scott said:
In a general module, I can get the name of the currently opened report with
code below. I have several reports that I run my code on and I'm trying to
find the correct syntax to reference a control on each report from the
general module. The control will be named the same on each report, so I
tried using rptCurrentReport.myControlName, but I get an error.

Is there a way to reference a control this way?

CODE **********

Set rptCurrentReport = Screen.ActiveReport
sReport = CStr(rptCurrentReport.Name)

If myControlName really is the name of the control, then
Screen.ActiveReport.myControlName
should work.

If myControlName is a string variable containing the name of
the controls, then use:
Screen.ActiveReport(myControlName)
 
Back
Top