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

Counting SubForms and SubReports

P: n/a

As means for boosting performance of an inherited Access97 database, I
would like to identify, count and reduce the subform and subreport
controls. Is there a programatic way of listing these controls?

Thanks for your help.


Nov 13 '05 #1
Share this Question
Share on Google+
1 Reply

P: n/a
Function ListSubs()
Dim db As Database
Dim con As Container
Dim doc As Document
Dim frm As Form
Dim ctl As Control
Dim strRetVal As String

Set db = CurrentDb
Set con = db.Containers("Forms")

For Each doc In con.Documents
DoCmd.OpenForm doc.Name, acDesign
Set frm = Forms(doc.Name)
For Each ctl In frm.Controls
If ctl.ControlType = acSubform Then
If Len(strRetVal) = 0 Then
strRetVal = frm.Name & ": " & ctl.Name
strRetVal = strRetVal & vbCrLf & frm.Name & ": " &
End If
End If
DoCmd.Close acForm, doc.Name
ListSubs = strRetVal

Set db = Nothing

End Function

Paste into new module and call from the debug window: ? ListSubs()

I'll let you figure out how to modify this function to return the same
thing from the reports collection.


Nov 13 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.