If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
control list
Is there a way to list out all controls in a report in Access 97? Thanks.
|
#2
|
|||
|
|||
control list
"00KobeBrian" wrote in message
Is there a way to list out all controls in a report in Access 97? Thanks. You mean, like ... DoCmd.OpenReport "YourReport", acViewDesign For Each ctl In Reports("YourReport").Controls Debug.Print ctl.Name Next ctl DoCmd.Close acReport, "YourReport", acSaveNo ? Or did you want to do something with the report while it's open in preview mode? -- Dirk Goldgar, MS Access MVP www.datagnostics.com (please reply to the newsgroup) |
#3
|
|||
|
|||
control list
Thanks, Is there a way to get the control data source as well?
"Dirk Goldgar" wrote in message ... "00KobeBrian" wrote in message Is there a way to list out all controls in a report in Access 97? Thanks. You mean, like ... DoCmd.OpenReport "YourReport", acViewDesign For Each ctl In Reports("YourReport").Controls Debug.Print ctl.Name Next ctl DoCmd.Close acReport, "YourReport", acSaveNo ? Or did you want to do something with the report while it's open in preview mode? -- Dirk Goldgar, MS Access MVP www.datagnostics.com (please reply to the newsgroup) |
#4
|
|||
|
|||
control list
"00KobeBrian" wrote in message
Thanks, Is there a way to get the control data source as well? "Dirk Goldgar" wrote in message ... "00KobeBrian" wrote in message Is there a way to list out all controls in a report in Access 97? Thanks. You mean, like ... DoCmd.OpenReport "YourReport", acViewDesign For Each ctl In Reports("YourReport").Controls Debug.Print ctl.Name Next ctl DoCmd.Close acReport, "YourReport", acSaveNo ? Or did you want to do something with the report while it's open in preview mode? Sure. Not all controls have a ControlSource property, so you have to either check the type of control or just ignore errors while attempting to list the ControlSource for all controls. A simple version would be like this: DoCmd.OpenReport "YourReport", acViewDesign On Error Resume Next For Each ctl In Reports("YourReport").Controls Debug.Print ctl.Name; Debug.Print , ctl.ControlSource; Debug.Print "" Next ctl On Error GoTo 0 ' or your error-handler DoCmd.Close acReport, "YourReport", acSaveNo -- Dirk Goldgar, MS Access MVP www.datagnostics.com (please reply to the newsgroup) |
#5
|
|||
|
|||
control list
Thanks, this is exactly I need.
"Dirk Goldgar" wrote in message ... "00KobeBrian" wrote in message Thanks, Is there a way to get the control data source as well? "Dirk Goldgar" wrote in message ... "00KobeBrian" wrote in message Is there a way to list out all controls in a report in Access 97? Thanks. You mean, like ... DoCmd.OpenReport "YourReport", acViewDesign For Each ctl In Reports("YourReport").Controls Debug.Print ctl.Name Next ctl DoCmd.Close acReport, "YourReport", acSaveNo ? Or did you want to do something with the report while it's open in preview mode? Sure. Not all controls have a ControlSource property, so you have to either check the type of control or just ignore errors while attempting to list the ControlSource for all controls. A simple version would be like this: DoCmd.OpenReport "YourReport", acViewDesign On Error Resume Next For Each ctl In Reports("YourReport").Controls Debug.Print ctl.Name; Debug.Print , ctl.ControlSource; Debug.Print "" Next ctl On Error GoTo 0 ' or your error-handler DoCmd.Close acReport, "YourReport", acSaveNo -- Dirk Goldgar, MS Access MVP www.datagnostics.com (please reply to the newsgroup) |
Thread Tools | |
Display Modes | |
|
|