I am using the following code to hide table from the object brouser for my data base works well
Have a table tblTableList and loop through this and hide the tables with a boolean value, hide table stet to true or -1
Can I do something similar with my queries?
Private Sub cmdHideTables_Click()
'Hide a table from the database window
'Note: This is different than the Access Object
'hidden''attribute that can be set with SetHiddenAttribute
On Error GoTo cmdHideTables_Click_Err
Dim rst As DAO.Recordset ' table list
Dim strTblList As String
Dim strTblName As String
Dim intTableCount As Integer
Dim lngAttributes As Long
Set db = CurrentDb()
Set rst = db.OpenRecordset("tblTableList", dbOpenSnapshot)
intTableCount = 0
Subjectline = InputBox("Please enter a password to confirm hiding of tables.", _
"Sac City Property Management")
If Subjectline = "123" Then
With rst
' Me.Recordset.Requery
rst.MoveFirst
Do Until rst.EOF = True
If rst!HideTable = -1 Then
intTableCount = intTableCount + 1
strTblName = rst!TableName
strTblList = strTblList & strTblName & ", "
With db.TableDefs(strTblName)
'Take a snapshot of the current bit fields
lngAttributes = .Attributes
'Now UNSET the ReadOnly bits in the SnapShot
'so we don't try to write to them.
lngAttributes = lngAttributes Or dbAttachedODBC
lngAttributes = lngAttributes Or dbAttachedTable
lngAttributes = lngAttributes - (dbAttachedODBC + dbAttachedTable)
'Now set the hidden bit, while maintaining the other
'writable bits
.Attributes = lngAttributes Or dbHiddenObject
End With
End If
rst.MoveNext
Loop
End With
MsgBox "The following table have been hidden: " & intTableCount & " " & vbCrLf & strTblList
'Reflect the change in the database window/nav pane
RefreshDatabaseWindow
Else 'Password is wrong
MsgBox "Password incorect"
End If