|
|
Question : Hide / Unhide Access Objects
|
|
(1). I have this code below to hide the tables. I am looking for this type of code to hide the other objects like: Forms, Queries, Macro and Modules. (2). I will also appreciate codes to unhide them. Thanks
I am already familiar with the "USYSTableName and ----> / Tools /Option to unhide.
I am open to other ideas using VBA. *********************** Here is my current code:
Function HideTables()
Dim tdf As QueryDef For Each tdf In CurrentDb.QueryDefs If tdf.Name Like "msys*" Then Else tdf.Attributes = dbHiddenObject End If Next tdf Set tdf = Nothing
End Function
|
Answer : Hide / Unhide Access Objects
|
|
u use the SetHiddenAttribute field as suggested
Best thing is to create a procedure which performs your actions and simply call that, pass in True of False, True to hide, False to unhide
e.g.
Public Sub HideUnhide(ByVal bHideUnhide As Boolean)
'Modules
Dim obj As Object Dim i As Integer
'Tables For i = 0 To CurrentDb.TableDefs.Count - 1 If Left$(CurrentDb.TableDefs(i).Name, 4) <> "MSys" Then Application.SetHiddenAttribute acTable, CurrentDb.TableDefs(i).Name, bHideUnhide Next i
'Queries For i = 0 To CurrentData.AllQueries.Count - 1 Application.SetHiddenAttribute acQuery, CurrentData.AllQueries(i).Name, bHideUnhide Next i
'Forms For Each obj In CurrentProject.AllForms Application.SetHiddenAttribute acForm, obj.Name, bHideUnhide Next obj
'Modules For Each obj In CurrentProject.AllModules Application.SetHiddenAttribute acModule, obj.Name, bHideUnhide Next obj
'Reports For Each obj In CurrentProject.AllReports Application.SetHiddenAttribute acReport, obj.Name, bHideUnhide Next obj
End Sub
|
|
|
|
|