Hello
I am using the following code to hide/show the tables
If I want to write the same code about queries, what will change?
so that they can be hidden by executing the query code.
Thanks
Function ShowHiddenObject(AttributesID As Integer)
Dim obj As AccessObject, dbs As Object
Set dbs = Application.CurrentData
Set db = CurrentDb
If AttributesID = 1 Then
For Each obj In dbs.AllTables
Set tdf = db.TableDefs(obj.Name)
If Left(tdf.Name, 4) <> "msys" And tdf.Attributes <> 1073741824 Then
tdf.Attributes = tdf.Attributes + dbHiddenObject
End If
Next
db.Close
Set db = Nothing
End If
If AttributesID = 2 Then
Set dbs = CurrentDb
For Each tdf In dbs.TableDefs
If Left(tdf.Name, 4) <> "msys" And tdf.Attributes <> 1073741824 _
And tdf.Attributes = 1 Then
tdf.Attributes = tdf.Attributes - dbHiddenObject
End If
Next tdf
Set dbs = Nothing
End If
Application.RefreshDatabaseWindow
End Function
I am using the following code to hide/show the tables
If I want to write the same code about queries, what will change?
so that they can be hidden by executing the query code.
Thanks
Function ShowHiddenObject(AttributesID As Integer)
Dim obj As AccessObject, dbs As Object
Set dbs = Application.CurrentData
Set db = CurrentDb
If AttributesID = 1 Then
For Each obj In dbs.AllTables
Set tdf = db.TableDefs(obj.Name)
If Left(tdf.Name, 4) <> "msys" And tdf.Attributes <> 1073741824 Then
tdf.Attributes = tdf.Attributes + dbHiddenObject
End If
Next
db.Close
Set db = Nothing
End If
If AttributesID = 2 Then
Set dbs = CurrentDb
For Each tdf In dbs.TableDefs
If Left(tdf.Name, 4) <> "msys" And tdf.Attributes <> 1073741824 _
And tdf.Attributes = 1 Then
tdf.Attributes = tdf.Attributes - dbHiddenObject
End If
Next tdf
Set dbs = Nothing
End If
Application.RefreshDatabaseWindow
End Function