Automatically hide any tables created in the database except one table (1 Viewer)

MsLady

Traumatized by Access
Local time
Yesterday, 22:51
Joined
Jun 14, 2004
Messages
438
I want to automatically hide all the tables in the database, and automatically hide any new tables that are created, imported thereafter, except one mastertable.
How do i achieve this?
 

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 06:51
Joined
Sep 12, 2006
Messages
15,710
try this

Code:
sub hide_them_all

dim tdf as tabledef

    for each tdf in currentdb.tabledefs
          if tdf.name<>"requiredname" then
                tdf.attributes = tdf.attributes+hiddenobject
          end if
    next tdf

end sub
 
Last edited:

MsLady

Traumatized by Access
Local time
Yesterday, 22:51
Joined
Jun 14, 2004
Messages
438
Thanks gemma :) where do i put this code?
 

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 06:51
Joined
Sep 12, 2006
Messages
15,710
in a module - if its a one-time code, just click the sub and run it directly
 

KeithG

AWF VIP
Local time
Yesterday, 22:51
Joined
Mar 23, 2006
Messages
2,592
This code won't hide tables made after you run the code. So if you run a make table query it won't be hidden. I don't think there really is a way that you can have a new table default to hidden. You could put Gemma's procedure in the On_Open event of your switchboard or startup form.
 

Users who are viewing this thread

Top Bottom