How to get name of the controls of report from a form

  • Thread starter Thread starter KRISH
  • Start date Start date
K

KRISH

Hi!

Anybody help me how to get name of the each control of a
report from a form.

Thanks for help.

Krish
 
Open the Report in DesignVier and use its Controls collection to find the
name.. this code runs from a standard module, but could be placed in the
form's module, perhaps in a command button's click event.

Sub ReportControls(strName As String)
Dim ctl As Control
DoCmd.OpenReport strName, acViewDesign, , , acHidden
For Each ctl In Reports(strName).Controls
Debug.Print ctl.Name
Next ctl
DoCmd.Close acReport, strName, acSaveYes
End Sub

Follow up, if need be, here in the newsgroup, not by e-mail.

Larry Linson
Microsoft Access MVP
 
Back
Top