fredg,
Thanks for your feedback.
No this isn't for a class project. This for a project at work. It just must be a co-winkie-dink.
I changed your code to this:
Public Sub GetDescriptionProperty()
' read the description property of a report
Dim db As DAO.Database
Dim doc As Document
Set db = CurrentDb
Dim prp As Property
Dim ctrLoop As Container
For Each ctrLoop In db.Containers
Debug.Print "Properties of " & ctrLoop.Name & " container"
For Each doc In ctrLoop.Documents
Debug.Print " - " & doc.Name
For Each prp In doc.Properties
' If prp.Name = "Description" Then
Debug.Print " - " & prp.Name & " " & prp.Value
' End If
Next prp
Next doc
Next ctrLoop
End Sub
Cool, now I know how to use Debug and the Immediate window--VERY HELPFUL. But the Immediate window isn't big enough to retain all
of the results from this procedure (and NO, dragging the boarder to make the window bigger won't help. I scroll all the way to the
top and only the last 200 lines are retained in the Immediate window). How would I (more appropriately--YOU ;-) ) edit this
code to export to a text file instead of printing to the Immediate window.
Thanks again for all of your help,
Conan
Just a small change is needed.
Create a new Report.
Add a unbound text control to the Detail section.
Make sure you set the control's CanGrow property to Yes
Name this control 'ShowProperty'.
Set the Detail CanGrow property to Yes.
Add a Report Header.
Place the following code in the Report Header Format event:
Private Sub ReportHeader_Format(Cancel As Integer, FormatCount As
Integer)
' read the Description property of a report
Me![ShowProperty] = ""
Dim db As DAO.Database
Dim doc As Document
Set db = CurrentDb
Dim prp As Property
For Each doc In db.Containers("reports").Documents
For Each prp In doc.Properties
If prp.Name = "Description" Then
Me![ShowProperty] = Me![ShowProperty] & doc.Name & " " &
prp.Name & " " & prp.Value & vbNewLine
End If
Next prp
Next doc
End Sub