Solved Form: Objects Navigation (see speakers_86)

vhung

Member
Local time
Yesterday, 16:33
Joined
Jul 8, 2020
Messages
235
Ive been using different approach for objects navigation,
but this one on current is unique.

I made little modification for (open/close, max/min),
looks like something i missed.

My idea is to count the number of tables on_click "Tables" button,
as table names shown on the list,
i wish to have the steps for that purpose.

But for now I could already navigate the objects as i need to,
I made additional coding whenever some changes occur depending to what object be opened.

Unsolved: ?=count the tables, query, reports, modules, macro
 

Attachments

  • ObjectsNavigation.png
    ObjectsNavigation.png
    106.4 KB · Views: 171
Something wrong with this code for query, total does not match the actual number of Queries

Dim qdf As DAO.QueryDef
Dim obj As Object
Dim tdf As DAO.TableDef
Dim i As Long

i = 0
Debug.Print CurrentDb.TableDefs.Count
For Each tdf In CurrentDb.TableDefs
If Not Left(tdf.Name, 5) = "MSys" Then
i = i + 1
End If
Next tdf

'Determine number of queries
Debug.Print "Number of Queries: " & CurrentDb.QueryDefs.Count
MsgBox "Number of Queries: " & i
 
i think you mean Left(tdf.Name, 4) = "Msys"
 
Dim i as integer, j as integer
i = 0: j = 0
Debug.Print CurrentDb.TableDefs.Count
For Each tdf In CurrentDb.TableDefs
If Not (tdf.Name, Like "MSys*") Then
If Len(Trim$(tdf.Connect & vbnullstring)) = 0 'table
i = i + 1
Else 'linked table
j = j + 1
End If
Next tdf
 
If Not Left(tdf.Name, 5) = "MSys", is the count of Local tables and Linked Tables plus "Msys"
Not the query counts-total
Unless my math skills have completely disappeared "MSys" is 4 letters.
The syntax of Left() is
Code:
Left ( text, number_of_characters )
 
Debug.Print CurrentDb.TableDefs.Count will return # of tabledefs
Code:
For Each tdf In CurrentDb.TableDefs
If Not Left(tdf.Name, 5) = "MSys" Then
i = i + 1
End If
Next tdf
This will return # of all tabledefs including the MSys tables because MSys is only 4 letters

Code:
MsgBox "Number of Queries: " & i
is returning # of all tables because that is what your iterating through to get i not the querydefs.
 
You allow me to keep going, thanks much to your guidance.

i try this way;

Dim i As Long
i = 0
If Left(aob.Name, 5) = "MSys" And Not Me.chkSystem Then GoTo skip
i = i + 1
Debug.Print "Number of Queries: " & i
skip:
Next
MsgBox "Number of Queries: " & i


It works, table and query count is done,
next would be acForm and ...
 

Attachments

  • objectquery.png
    objectquery.png
    66.3 KB · Views: 264
Last edited:
Form, Module, Macro and Report count is done aleady,
some code Syntax vary as obejct type changes.

Thanks for the help: "arnelgp" and "moke123", good hints.
 
Why are you looping? Just do a query to get the count on al objects.
 

Users who are viewing this thread

Back
Top Bottom