Results 1 to 10 of 10
  1. #1
    Star Lounger
    Join Date
    Apr 2006
    Location
    California
    Posts
    69
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Document Reports (2003 (11.6566.6568( SP2)

    I'm atttempting to document the tables, forms and reports in my project. The built-in Documenter tool doesn't meet my needs as I need to group the various objects by my own categorizations. I have been able to use Application.CurrentProject and ALLTABLES to enumerate the tables and fields successfully. However, it appears in order to enumerate the controls on a report, the report must be open. Most of my reports are dependant on one or more specific forms being open, so a docmd.openreport reportname fails as the related form/s is/are not open. Is there another approach which does not require the report to be open in order to loop through its controls?

  2. #2
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts

    Re: Document Reports (2003 (11.6566.6568( SP2)

    I would think you could use docmd.openreport reportname, acDesign to open in design view, and then the dependency on other forms should not matter.
    Regards
    John



  3. #3
    Star Lounger
    Join Date
    Apr 2006
    Location
    California
    Posts
    69
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Document Reports (2003 (11.6566.6568( SP2)

    Thanks that solved the initial problem ( Sorry for the slow thank-you, but just got back into town.)

    However, it has lead to another confusion on my part. I don't seem to be able to get the syntax down to reference some of the report control properties as I'm getting the error: "You entered an expression that has an invalid reference to the property DefaultValue."

    For Each obj In dbs.AllReports
    Select Case obj.Name
    Case "rptSchedNarrativeSummary_APT_WithSightVisit", _
    "rptSchedNarrativeSummary_APT_WOSightVisit", _
    "rptSchedNarrativeSummary_PD_WithSightVisit", _
    "rptSchedNarrativeSummary_PD_WOSightVisit"
    stCat = "DIRECTORY Reports"
    DoCmd.OpenReport obj.Name, acDesign
    For Each ctl In Reports(obj.Name).Controls
    rst.AddNew
    rst!Cat = "NARRATIVE SUMMARY"
    rst!ItemDtl = obj.Name
    rst!FieldName = ctl.Name
    rst!FieldType = FindControlType(ctl.ControlType)
    Select Case ctl.ControlType
    Case acTextBox
    rst!FieldDefault = ctl.DefaultValue 'OFFENDING LINE
    Case acLabel
    rst!FieldCaption = ctl.Caption 'OFFENDING LINE
    End Select
    rst.Update
    Next ctl
    DoCmd.Close acReport, obj.Name, acSaveNo
    End Select
    Next obj

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Document Reports (2003 (11.6566.6568( SP2)

    DefaultValue is meaningless on a report. This property is used on forms to set the default value for a control when the user creates a new record. You can't create a new record in a report, so DefaultValue is not available.

    The caption of labels should be available, however.

  5. #5
    Star Lounger
    Join Date
    Apr 2006
    Location
    California
    Posts
    69
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Document Reports (2003 (11.6566.6568( SP2)

    Duh, how stupid am I. It was supposed to be ControlSource and I read it as that ... even though it clearly is not!

  6. #6
    Star Lounger
    Join Date
    Apr 2006
    Location
    California
    Posts
    69
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Document Reports (2003 (11.6566.6568( SP2)

    With your assistance I have things working as envisioned. However, a new requirement has come up ... I need to capture the name of the section each control is in. So far I've been totally unsuccessful with the syntax to accomplish this. Any suggestions would be most appreciated

  7. #7
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Document Reports (2003 (11.6566.6568( SP2)

    The Section property of a control returns a number that indicates the section the control belongs to.

    <table border=1><td>Value</td><td>Constant</td><td>Description</td><td align=right>0</td><td>acDetail</td><td>Detail section</td><td align=right>1</td><td>acHeader</td><td>Report header</td><td align=right>2</td><td>acFooter</td><td>Report footer</td><td align=right>3</td><td>acPageHeader</td><td>Page header</td><td align=right>4</td><td>acPageFooter</td><td>Page footer</td><td align=right>5</td><td>acGroupLevel1Header</td><td>Level 1 group header</td><td align=right>6</td><td>acGroupLevel1Footer</td><td>Level 1 group footer</td><td align=right>7</td><td>acGroupLevel2Header</td><td>Level 2 group header</td><td align=right>8</td><td>acGroupLevel2Footer</td><td>Level 2 group footer</td></table>
    See the help for the Section property for more info.

  8. #8
    Star Lounger
    Join Date
    Apr 2006
    Location
    California
    Posts
    69
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Document Reports (2003 (11.6566.6568( SP2)

    Hans, Thanks for the info.
    I've reread the help on Section property. It shows various ways to reference a known section. Sorry for being a dunce on this, but I'm trying to figure out, so far unsuccessfully, the syntax to return the Section identification that a control is in {see my For Each ctl in Reports(obj.Name).Controls in my Jul 6th post}. Within this loop, I would like to determine the section each control is in and then make an assignment of a corresponding text value (ala the translation you provided) to the recordset .

  9. #9
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Document Reports (2003 (11.6566.6568( SP2)

    For Each ctl In Reports(obj.Name).Controls
    rst.AddNew
    ...
    ...
    Select Case ctl.Section
    Case 0
    rst!FieldSection = "Detail"
    Case 1
    rst!FieldSection = "Report Header"
    ....
    Case 8
    rst!FieldSection = "Level 2 Group Footer"
    Case Else
    rst!FieldSection = "Higher level group header or footer"
    End Select
    rst.Update
    Next ctl

  10. #10
    Star Lounger
    Join Date
    Apr 2006
    Location
    California
    Posts
    69
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Document Reports (2003 (11.6566.6568( SP2)

    How simple.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •