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

Counting SubForms and SubReports

P: n/a
Hi,

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.

Henry

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
Else
strRetVal = strRetVal & vbCrLf & frm.Name & ": " &
ctl.Name
End If
End If
Next
DoCmd.Close acForm, doc.Name
Next
ListSubs = strRetVal

db.Close
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.

Cheers.

Nov 13 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.