Hi all,
Thanks for posting in the group! I believe Solex's suggestion is helpful to
implement the task of hiding/showing a QUERY. The SetHiddenAttribute method
sets the hidden attribute available in the properties sheet of the object.
For more information, refer to the following article:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbaac10/htm
l/acmthGetHiddenAttribute.asp
Prior to Jet 4.0 (Jet 3.5/3.0...), we can set a TABLE's attribute property
through code using either of the following lines of code, which will cause
the table to be hidden at the Jet Database Engine level.
CurrentDb.TableDefs("TableName").Attributes = 1
CurrentDb.TableDefs("TableName").Attributes = dbHiddenObject
CurrentDb.TableDefs("TableName").Properties(5) = 1
CurrentDb.TableDefs("TableName").Properties(5) = dbHiddenObject
The table object will be hiden from the Microsoft Access Database
Container, and it is marked as a temporary table in the Jet Database
Engine. When it is compacted it is deleted and removed from the MSysObjects
table. There is no reference to the table anymore and no way to get the
table back. It appears that there exists two different bit values to mean
hidden in the Microsoft Jet Database Engine. JET_bitFHidden and
JET_bitFHiddenUsr. On Compact, we are blowing away those tables that are
marked JET_bitFHidden.
In Jet 4.0 (Access 2000, 2002, 2003), the dbHiddenObject method no longer
works. It is recommended to use the SetHiddenAttribute method to hide the
table/query:
Application.SetHiddenAttribute acTable/acQuery,"myTable/myQuery", True
Or, use one of the following workarounds to hide the table:
1. Setting the Tables Attributes property to hidden through the User
Interface(UI) by right clicking on the table name and going to properties
and checking 'Hidden'.
2. Setting the Tables Attributes property through code to make the table a
System Table.
CurrentDb.TableDefs("TableName").Attributes = 2
CurrentDb.TableDefs("TableName").Attributes = dbSystemObject
CurrentDb.TableDefs("TableName").Properties(5) = 2
CurrentDb.TableDefs("TableName").Properties(5) = dbSystemObject
3. Rename the table to USysTableName to make it a User System Table
Best regards,
Billy Yao
Microsoft Online Support