A Microsoft Office (Excel, Word) forum. OfficeFrustration

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.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

control list



 
 
Thread Tools Display Modes
  #1  
Old October 24th, 2006, 03:15 AM posted to microsoft.public.access.forms,microsoft.public.access.formscoding,microsoft.public.access.modulesdaovba
00KobeBrian
external usenet poster
 
Posts: 77
Default control list

Is there a way to list out all controls in a report in Access 97? Thanks.


  #2  
Old October 24th, 2006, 03:46 AM posted to microsoft.public.access.forms,microsoft.public.access.formscoding,microsoft.public.access.modulesdaovba
Dirk Goldgar
external usenet poster
 
Posts: 1,164
Default 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  
Old October 24th, 2006, 04:41 AM posted to microsoft.public.access.forms,microsoft.public.access.formscoding,microsoft.public.access.modulesdaovba
00KobeBrian
external usenet poster
 
Posts: 77
Default 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  
Old October 24th, 2006, 04:59 AM posted to microsoft.public.access.forms,microsoft.public.access.formscoding,microsoft.public.access.modulesdaovba
Dirk Goldgar
external usenet poster
 
Posts: 1,164
Default 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  
Old October 24th, 2006, 06:04 AM posted to microsoft.public.access.forms,microsoft.public.access.formscoding,microsoft.public.access.modulesdaovba
00KobeBrian
external usenet poster
 
Posts: 77
Default 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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 07:40 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.