DaBears said:
I have a mdb with a large number of forms open at the same time. I think I
might be hitting the 32768 object limit. Is there any way to monitor the
object count so I can prove or disprove my suspicions.
Do you want to know the total number of objects in the database, or the
total number that are open at the moment? I don't know a summary way to get
the count of all objects, but you can get the number of objects of each
type.
Forms -
Total count = CurrentProject.AllForms.Count
Open count = Forms.Count
Reports -
Total count = CurrentProject.AllReports.Count
Open count = Reports.Count
Modules -
Total count = CurrentProject.AllModules.Count
(Doesn't include form/report modules)
Open count = Modules.Count
(includes any form/report modules that are open
in the VB Editor)
Macros -
Total count = CurrentProject.AllMacros.Count
Open count -- code is required to determine this:
Dim NOpenMacros As Long
Dim ao As AccessObject
For each ao In CurrentProject.AllMacros
If ao.IsLoaded Then NOpenMacros = NOpenMacros + 1
Next ao
' NOpenMacros now contains the number of open macros.
Tables -
Total count = CurrentData.AllTables.Count
Open count -- code is required to determine this:
Dim NOpenTables As Long
Dim ao As AccessObject
For each ao In CurrentData.AllTables
If ao.IsLoaded Then NOpenTables = NOpenTables + 1
Next ao
' NOpenTables now contains the number of open tables.
Queries -
Total count (user queries) = CurrentData.AllQueries.Count
Total count (user & system queries) = CurrentDb.QueryDefs.Count
Open count -- code is required to determine this:
Dim NOpenQueries As Long
Dim ao As AccessObject
For each ao In CurrentData.AllQueries
If ao.IsLoaded Then NOpenQueries = NOpenQueries + 1
Next ao
' NOpenQueries now contains the number of open Queries.