Ever need to set a Table or other Access DB object to Hidden programmatically? Well here's the way to do it that
makes the object hidden EVEN if the user unchecks the "Show Hidden Objects" feature in the Options dialog box.
There are no ways to show the Object unless you programmatically turn it back on.
Before:
After:
Gangsta YodaVB Code:
'Copyright © 2005 by RobDog888 (VB/Office Guru™). All Rights reserved. ' 'Distribution: You can freely use this code in your own ' applications provided that this copyright ' is left unchanged, but you may not reproduce ' or publish this code on any web site, online ' service, or distribute as source on any ' media without express permission. ' 'Requirements: 'MS Access version 97 (8.0) - 2003 (11.0) ' ' 'In a Module: Option Explicit Option Compare Database Public Sub HideTable(ByVal sTableName As String) Application.CurrentDb.TableDefs(sTableName).Properties("Attributes").Value = dbHiddenObject End Sub Public Sub ShowTable(ByVal sTableName As String) Application.CurrentDb.TableDefs(sTableName).Properties("Attributes").Value = 0 End Sub ' ' '********************************************************* ' 'Example usage: 'Behind a Form ' ' Option Explicit Option Compare Database Private Sub cmdHide_Click() HideTable "Table1" End Sub Private Sub cmdShow_Click() ShowTable "Table1" End Sub![]()





Reply With Quote