Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using Access Object Model

Status
Not open for further replies.
Jun 25, 2003
31
GB
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:

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
... 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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top