Solved Form: Objects Navigation (see speakers_86) (1 Viewer)

vhung

Member
Local time
Today, 08:43
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: 130

vhung

Member
Local time
Today, 08:43
Joined
Jul 8, 2020
Messages
235
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
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 23:43
Joined
May 7, 2009
Messages
19,169
i think you mean Left(tdf.Name, 4) = "Msys"
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 23:43
Joined
May 7, 2009
Messages
19,169
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
 

moke123

AWF VIP
Local time
Today, 11:43
Joined
Jan 11, 2013
Messages
3,851
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 )
 

moke123

AWF VIP
Local time
Today, 11:43
Joined
Jan 11, 2013
Messages
3,851
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.
 

vhung

Member
Local time
Today, 08:43
Joined
Jul 8, 2020
Messages
235
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: 224
Last edited:

vhung

Member
Local time
Today, 08:43
Joined
Jul 8, 2020
Messages
235
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.
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 11:43
Joined
May 21, 2018
Messages
8,463
Why are you looping? Just do a query to get the count on al objects.
 

Users who are viewing this thread

Top Bottom