Refer to a reports control with variables

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

Guest

I am trying to get the value of a textbox on my report called t_title and set
as a variable. The following works,

currReport = [Reports]![rpt_PL_General]![t_title]

however the report need to change its name so I want to refer to it as
either the current report or replace [rpt_PL_General] as a variable.

Ive tried the following with no success...

Bruce

currReport = [Reports]!Me![t_title]

and

a = "rpt_PL_General"
currReport = [Reports]![ & a & ]![t_title]
 
Bruce said:
I am trying to get the value of a textbox on my report called t_title and set
as a variable. The following works,

currReport = [Reports]![rpt_PL_General]![t_title]

however the report need to change its name so I want to refer to it as
either the current report or replace [rpt_PL_General] as a variable.

Ive tried the following with no success...

Bruce

currReport = [Reports]!Me![t_title]

and

a = "rpt_PL_General"
currReport = [Reports]![ & a & ]![t_title]
If you are running this code from the Report's own module then just use Me.

Me![t_title]
 
Bruce said:
I am trying to get the value of a textbox on my report called t_title and set
as a variable. The following works,

currReport = [Reports]![rpt_PL_General]![t_title]

however the report need to change its name so I want to refer to it as
either the current report or replace [rpt_PL_General] as a variable.

Ive tried the following with no success...

Bruce

currReport = [Reports]!Me![t_title]

and

a = "rpt_PL_General"
currReport = [Reports]![ & a & ]![t_title]


You can refer to a member of a collection using the name as
the index:

Reports(a)![t_title]
 
Back
Top