JamesHardiman
MIS
Yesterday I got help with iterating through the Reports collection (whether or not closed or open)... for which thanks!
Now I'm trying to iterate through the properties of a report, but can't get my head round the object model.
This is what I have:
... but that doesn't come close. For a start the For Each Prop doesn't work: there are usually no properties, and if I do a watch on it, the properties I see aren't those that I want. If I type in Reports(obj.name). I get that nice VB drop-down menu of all the properties of a report. But I want to get at that in run time, not design time.
My brain's beginning to fuse again: can anyone help?
Thanks
JamesH@Sunsail.com
Now I'm trying to iterate through the properties of a report, but can't get my head round the object model.
This is what I have:
Code:
Private Sub cmdDoit_Click()
Dim obj As AccessObject
Dim dbs As Object
Dim prop As AccessObjectProperty
Dim rs As ADODB.Recordset
' Open connection and recordset...
' Goes here
Set dbs = Application.CurrentProject
' Search for open AccessObject objects in AllReports collection.
For Each obj In dbs.AllReports
DoCmd.OpenReport obj.Name, acViewDesign
For Each prop In obj.AccessObjectProperties
rs.AddNew
rs!ObjectName = obj.Name
rs!PropertyName = prop.Name
rs!NewValue = Reports(obj.Name).Value
DoCmd.Close acReport, obj.Name
rs.Update
Next prop
Next obj
rs.Close
End Sub
My brain's beginning to fuse again: can anyone help?
Thanks
JamesH@Sunsail.com