By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,225 Members | 1,434 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,225 IT Pros & Developers. It's quick & easy.

Generate a list of objects on a report and select properties

P: 44
Hi,

I've made a mess of a report. I need to do some cleanup and I need a utility to help me look at all the objects on the report.

I used to have some code for listing all the objects on a report and selectively list properties of that report. I cannot find the code and I am unable to find the posting that provided it.

can anyone help me out?

Basically, I want to pass a report name to a function, and return all the objects on that report and specific property values for each of those objects.

Thanks!
Oct 9 '08 #1
Share this Question
Share on Google+
4 Replies


ADezii
Expert 5K+
P: 8,679
I wrote this code minutes before going to bed, it can easily be incorporated into a Function:
Expand|Select|Wrap|Line Numbers
  1. On Error Resume Next
  2.  
  3. Dim ctl As Control
  4. Dim rpt As Report
  5. Dim prp As Property
  6.  
  7. DoCmd.OpenReport "rptEmployees2", acViewDesign, , , acHidden
  8.  
  9. Set rpt = Reports("rptEmployees2")
  10.  
  11. For Each ctl In rpt.Controls
  12.   Debug.Print ctl.Name
  13.     For Each prp In ctl.Properties
  14.       Debug.Print "  |-- " & prp.Name & " ==> " & prp.Value
  15.     Next
  16. Next
Sample OUTPUT:
Expand|Select|Wrap|Line Numbers
  1. FirstName
  2.   |-- EventProcPrefix ==> FirstName
  3.   |-- Name ==> FirstName
  4.   |-- ControlType ==> 109
  5.   |-- ControlSource ==> FirstName
  6.   |-- Format ==> 
  7.   |-- DecimalPlaces ==> 255
  8.   |-- InputMask ==> 
  9.   |-- Visible ==> True
  10.   |-- Vertical ==> False
  11.   |-- HideDuplicates ==> False
  12.   |-- CanGrow ==> False
  13.   |-- CanShrink ==> False
  14.   |-- RunningSum ==> 0
  15.   |-- Left ==> 3180
  16.   |-- Top ==> 60
  17.   |-- Width ==> 1170
  18.   |-- Height ==> 270
  19.   |-- BackStyle ==> 0
  20.   |-- BackColor ==> 16777215
  21.   |-- SpecialEffect ==> 0
  22.   |-- BorderStyle ==> 0
  23.   |-- OldBorderStyle ==> 0
  24.   |-- BorderColor ==> 0
  25.   |-- BorderWidth ==> 0
  26.   |-- BorderLineStyle ==> 0
  27.   |-- ForeColor ==> 0
  28.   |-- FontName ==> Arial
  29.   |-- FontSize ==> 8
  30.   |-- FontWeight ==> 400
  31.   |-- FontItalic ==> False
  32.   |-- FontUnderline ==> False
  33.   |-- TextFontCharSet ==> 0
  34.   |-- TextAlign ==> 0
  35.   |-- FontBold ==> 0
  36.   |-- ShortcutMenuBar ==> 
  37.   |-- Section ==> 0
  38.   |-- Tag ==> 
  39.   |-- InSelection ==> False
  40.   |-- LeftMargin ==> 0
  41.   |-- TopMargin ==> 0
  42.   |-- RightMargin ==> 0
  43.   |-- BottomMargin ==> 0
  44.   |-- LineSpacing ==> 0
  45.   |-- IsHyperlink ==> False
  46. Text7
  47.   |-- EventProcPrefix ==> Text7
  48.   |-- Name ==> Text7
  49.   |-- ControlType ==> 109
  50.   |-- ControlSource ==> =Now()
  51.   |-- Format ==> Long Date
  52.   |-- DecimalPlaces ==> 255
  53.   |-- InputMask ==> 
  54.   |-- Visible ==> True
  55.   |-- Vertical ==> False
  56.   |-- HideDuplicates ==> False
  57.   |-- CanGrow ==> False
  58.   |-- CanShrink ==> False
  59.   |-- RunningSum ==> 0
  60.   |-- Left ==> 60
  61.   |-- Top ==> 240
  62.   |-- Width ==> 4560
  63.   |-- Height ==> 300
  64.   |-- BackStyle ==> 0
  65.   |-- BackColor ==> 16777215
  66.   |-- SpecialEffect ==> 0
  67.   |-- BorderStyle ==> 0
  68.   |-- OldBorderStyle ==> 0
  69.   |-- BorderColor ==> 0
  70.   |-- BorderWidth ==> 0
  71.   |-- BorderLineStyle ==> 0
  72.   |-- ForeColor ==> 8388608
  73.   |-- FontName ==> Times New Roman
  74.   |-- FontSize ==> 9
  75.   |-- FontWeight ==> 700
  76.   |-- FontItalic ==> True
  77.   |-- FontUnderline ==> False
  78.   |-- TextFontCharSet ==> 0
  79.   |-- TextAlign ==> 1
  80.   |-- FontBold ==> 1
  81.   |-- ShortcutMenuBar ==> 
  82.   |-- Section ==> 4
  83.   |-- Tag ==> 
  84.   |-- InSelection ==> False
  85.   |-- LeftMargin ==> 0
  86.   |-- TopMargin ==> 0
  87.   |-- RightMargin ==> 0
  88.   |-- BottomMargin ==> 0
  89.   |-- LineSpacing ==> 0
  90.   |-- IsHyperlink ==> False
  91. Text8
  92.   |-- EventProcPrefix ==> Text8
  93.   |-- Name ==> Text8
  94.   |-- ControlType ==> 109
  95.   |-- ControlSource ==> ="Page " & [Page] & " of " & [Pages]
  96.   |-- Format ==> 
  97.   |-- DecimalPlaces ==> 255
  98.   |-- InputMask ==> 
  99.   |-- Visible ==> True
  100.   |-- Vertical ==> False
  101.   |-- HideDuplicates ==> False
  102.   |-- CanGrow ==> False
  103.   |-- CanShrink ==> False
  104.   |-- RunningSum ==> 0
  105.   |-- Left ==> 4740
  106.   |-- Top ==> 240
  107.   |-- Width ==> 4560
  108.   |-- Height ==> 300
  109.   |-- BackStyle ==> 0
  110.   |-- BackColor ==> 16777215
  111.   |-- SpecialEffect ==> 0
  112.   |-- BorderStyle ==> 0
  113.   |-- OldBorderStyle ==> 0
  114.   |-- BorderColor ==> 0
  115.   |-- BorderWidth ==> 0
  116.   |-- BorderLineStyle ==> 0
  117.   |-- ForeColor ==> 8388608
  118.   |-- FontName ==> Times New Roman
  119.   |-- FontSize ==> 9
  120.   |-- FontWeight ==> 700
  121.   |-- FontItalic ==> True
  122.   |-- FontUnderline ==> False
  123.   |-- TextFontCharSet ==> 0
  124.   |-- TextAlign ==> 3
  125.   |-- FontBold ==> 1
  126.   |-- ShortcutMenuBar ==> 
  127.   |-- Section ==> 4
  128.   |-- Tag ==> 
  129.   |-- InSelection ==> False
  130.   |-- LeftMargin ==> 0
  131.   |-- TopMargin ==> 0
  132.   |-- RightMargin ==> 0
  133.   |-- BottomMargin ==> 0
  134.   |-- LineSpacing ==> 0
  135.   |-- IsHyperlink ==> 0
Oct 10 '08 #2

ADezii
Expert 5K+
P: 8,679
Oops, forgot to Close the Report after interrogating it. Add this single line of code after the last line (#16):
Expand|Select|Wrap|Line Numbers
  1. DoCmd.Close acReport, "rptEmployees2", acSaveNo
Oct 10 '08 #3

P: 44
Thanks! That is just what I needed.

I just pulled the code into a function and passed it my report name. instead of debug.print... I passed the string to a generic function I have for appending to a table.
Oct 14 '08 #4

ADezii
Expert 5K+
P: 8,679
Thanks! That is just what I needed.

I just pulled the code into a function and passed it my report name. instead of debug.print... I passed the string to a generic function I have for appending to a table.
Glad you got what you asked for.
Oct 14 '08 #5

Post your reply

Sign in to post your reply or Sign up for a free account.