DataBase - is there a way to get number of "objects" in a Access db?
Asked By DaBears
20-Nov-09 09:19 AM
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.
VB
(1)
NOpenQueries
(1)
NOpenTables
(1)
NOpenMacros
(1)
CountOfId
(1)
Database
(1)
Report
(1)
Edison
(1)
Daryl S replied to DaBears
DaBears -
This will cound all the objects in the MSysObjects table. Obviously, do not
mess with the system tables...
SELECT Count(MSysObjects.Id) AS CountOfId
FROM MSysObjects;
--
Daryl S
Dirk Goldgar replied to DaBears

Do you want to know the total number of objects in the database, or the
total number that are open at the moment? I do not 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.
--
Dirk Goldgar, MS Access MVP
Access tips: www.datagnostics.com/tips.html
(please reply to the newsgroup)
DaBears replied to Dirk Goldgar
Thanks, I will take a look at this. Wouldn't controls on forms and reports
also contribute to object count? Do they count only if form/report is open?
My thinking is that if Access as limit of 32,768 objects, then how does it
keep track? Simple table
Marshall Barton replied to DaBears
That is really difficult for me to imagine. Note that the
the number of objects in the database is not the same as the
number of open forms/reports, etc.
You can get the numbe of open forms by using ?Forms.Count in
the Immediate window
I would also be concerned that you might have some code that
opesn recordsets in a loop, creates querydefs on the fly, or
?
--
Marsh
MVP [MS Access]
Dirk Goldgar replied to DaBears
I do not think controls count at all, so far as this limit is concerned.
I believe all the objects are stored in the system table MSysObjects, with
some additional information stored in other system tables. However, I do not
know the details of this structure nor why the limit is so small. The
primary key field of MSysObjects is a long integer, so that is not the
limiting factor.
--
Dirk Goldgar, MS Access MVP
Access tips: www.datagnostics.com/tips.html
(please reply to the newsgroup)
Jack Leach replied to Dirk Goldgar
This limit is for the total number of objects, closed or open, correct?
--
Jack Leach
www.tristatemachine.com
-Thomas Edison (1847-1931)
Jeff Boyce replied to DaBears

Define "large" ... (do you mean more than 3, more than 10, more than 100?)
If more than 3, why? Do you expect your users to be simultaneously using
multiple screens, performing multiple tasks? (are they all under 30?<g>).
As an alternate approach, if you provide your users a single form at a time,
focusing what they are working on to a single topic, you would never need to have
more than one form open at a time.
Of course, I do not have any idea of your specific situation because you
have not described it, so the above ideas may not be germane.
If you would like folks here to offer more specific suggestions, provide more
specific descriptions.
Good luck!
Regards
Jeff Boyce
Microsoft Access MVP
--
Disclaimer: This author may have received products and services mentioned
in this post. Mention and/or description of a product or service herein
does not constitute endorsement thereof.
Any code or pseudocode included in this post is offered "as is", with no
guarantee as to suitability.
You can thank the FTC of the USA for making this disclaimer
possible/necessary.
Dirk Goldgar replied to Jack Leach
Yes.
--
Dirk Goldgar, MS Access MVP
Access tips: www.datagnostics.com/tips.html
(please reply to the newsgroup)

com / If Microsoft had not scuttled "real" Visual Basic in favor of Visual Fred (aka VB.NET), I'd say you might as well spend 3 - 5 times as long (if more if it does not) and that many times more effort to write it in VB. The same ratio will apply if you use unbound forms and ADO in Access. ODBC experience - rewriting an already-developed Access app using VB6 was 3x. Would you say that VB.NET would take more than that or less - assuming an experienced .NET developer. - - PeteCresswell 9a49 projects where I was enhancing existing databases - - most of those were done by "refugees from VB" who'd been drafted to work on an Access project because, "after all, the development tools are almost identical" (which anyone who is worked with both Access and classic VB knows to be only a superficial resemblance). Oh, I saw one case of some folks Office Access MVP it Just from observation at user group demonstrations, not personal use of VB.NET, I'd guess developing VB.NET would be less efficient at producing working, tested code than classic VB. I know I have _re-created_ an existing classic VB application of modest complexity in
VB and set of Data bases DataBase Bonjour, I have a set of databases. Each database has a VB procedure to launch the database queries. These databases are used in sequence : Database_3 needs data in is turn needs data from tables generated in database_1. Is it possible to launch VB proc = E9dures of database_1 and database_2 from database_3 ? And how to perform this job ? Thanks in anticipation for your help. le Nordiste Access Discussions VB (1) Database (1) QryWhatever (1) InThere (1) Mvps.invalid (1) Procédures (1) Arvinm (1) Com run out of resources and crash the machine. You can also run queries without using VB, just call the second query from the first: SELECT * FROM [C: \ DatabasePath \ Database2.mdb].qryWhatever www.mvps.org / access Bonjour, I have a set of databases. Each database has a VB procedure to launch the database queries. These databases are used in sequence : Database_3 needs data in is turn needs data from tables generated in database_1. Is it possible to launch VB procédures of database_1 and database_2 from database_3 ? And how to perform this job ? Thanks in http: / / www.dfenton.com / usenet at dfenton dot com http: / / www.dfenton.com / DFA / keywords: VB, and, set, of, Data, bases description: Bonjour, I have a set of databases. Each database
help files in Access 2007 VB DataBase I have just started writing some VB again, after a break. the difference is now I am using 2007. when I try to look up help for VB, instead of getting local support, I am directed to an online source AND most of program. What happended to all the great doucmentation for all of the command words in VB? Access Discussions Access Options Trust Center Privacy Options (1) Access 2007 (1) Office (1) VB (1) Online (1) Turn off the option to search online help so that you are content". Jeanette Cunningham MS Access MVP - - Melbourne Victoria Australia keywords: help, files, in, Access, 2007, VB description: I have just started writing some VB again, after a break. the difference is now I am using 2007. when I try to look up help for VB, instead of getting l
VB code to Access 2000 code DataBase I have a vb project which sends emails. [This is on the site http: / / www.jsware.net / jsware / vbcode for Form1 can reference the control like:- ThisVariable = MUC.SomeFunction() or MUC.some_MUCvariable = "this" The vb project file for the User Control is MailUC.ctl ?? how can I get this control and place it on a form there?? - - Jim Bunton Access Discussions UserControl (1) Describe (1) VB (1) Control (1) Database (1) Vb project (1) Jim, Look at the SendObject function in Access Help to see if that do what I am looking for. The object is one that is currently in a VB application and I am looking to use it in an Access application. Seems more like if we can come up with a way to do it in Access. Steve keywords: VB, code, to, Access, 2000, code description: I have a vb project which sends emails. [This is on the site www.jsware.net / jsware / vbcode.php5
nicht am Start) eine intensiv genutzte Plattform. Soweit ich das verfolgt habe, wird in der vb-NG am intensivsten ?ber eine Nachfolge- / Ersatzm?glichkeit diskutiert, der Thread dort hat mittlerweile 137 Antworten. Je nachdem was dort herauskommt (ich hoffe, das gilt dann auch f?r vb.net), teste ich das vielleicht noch an. F?r den Office- und den SQLServer-Bereich Ich wollte das hier auch schon mal erw?hnen. Ist auch interessant, weil auf mpd.vb *noch* weniger los war, als hier. Aber f?r die Regulars dort ist es auch am Start bin, da meine Anwendungen als BE einen SQLServer und als FE Office oder vb bzw.vb.net haben.) [. . .] Naja, Harald scheint ja etwas zu versuchen, w?re sch?n wenn da bald danach eingeschlafen ist. ;-) Wie ich andeutete, verfolge ich den Thread in m.p.d.vb und dort lieferst Du ja einen beeindruckenden "Kampf" pro Forum. Da sind schon die Argumente NGs an anderer Stelle und w?rde es begr??en, wenn es ?hnlich zu mpd.vb zu einem gesammelten ?bertritt der Regulars zu einer neuen Adresse k?me. Und sonst w