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

K

KRISH

Hi!

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

Thanks for help.

Krish
 
L

Larry Linson

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
 

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