How to Hide a table

If you don’t want a table to show in the Database Window (Access 2003 and prior) or in the navigation pane (Access 2007 and Access 2010) you have three options:

*Note: Works with local and linked tables*

1)      Name the table with the Usys prefix. This tells Access that the table is a User System Object. By default, Access does not show system objects. To later show the table select show System Objects in the Options.

2)      In the table's properties check the Hidden property. By default, Access does not show Hidden objects. To later show the table select show Hidden Objects in the Options.

3)      It is possible to use VBA code to hide a table. This will completely hide the table. The only way to see the table again in the database or navigation pane is to use VBA code to unhide the table.
*** Warning!***With older versions of JET there is a bug where running compact on a database would delete tables marked hidden with this method. It has been fixed in later versions. It is very important that you test to see if this works with your version of JET.

 

Example VBA Code

Public Sub HideTable(strTablename As String)
With CurrentDb
With .TableDefs(strTablename)
.Attributes = .Attributes Or dbHiddenObject
End With
End With
RefreshDatabaseWindow
End Sub


Public Sub UnHideTable(strTablename As String)
With CurrentDb
With .TableDefs(strTablename)
If dbHiddenObject = (.Attributes And dbHiddenObject) Then
.Attributes = .Attributes - dbHiddenObject
End If
End With
End With
RefreshDatabaseWindow
End Sub

 




If you need to hide a table like user names and password you should also consider encrypting the data.