Hide All DB Objects

  • Thread starter franklinbukoski
  • Start date
F

franklinbukoski

I would like to hide all forms, queries, reports, and macros.

Is there a way to select all and hide at one time or I am stuck with
selecting each individual object, right clicking, selecting properties,
selecting hide, closing, and repeat...
 
V

Vladimír Cvajniga

I think you could do it from code for each collection of objects (set
Attribues = 0).

WARNING!!!
Hidden objects may be removed from project on compression without warning!!!

Vlado

"franklinbukoski" <[email protected]> píše v
diskusním příspěvku
news:[email protected]...
 
D

Dirk Goldgar

franklinbukoski said:
I would like to hide all forms, queries, reports, and macros.

Is there a way to select all and hide at one time or I am stuck with
selecting each individual object, right clicking, selecting
properties, selecting hide, closing, and repeat...

You have to do it in code, and you'll have to loop through each of the
object collections. Do NOT use the DAO dbHiddenObject attribute.
Instead, use the SetHiddenAttribute method of the Access Application
object. Your code might look something like the following *untested*
air code:

Dim ao As AccessObject

' Hide all forms
For Each ao In CurrentProject.AllForms
Application.SetHiddenAttribute acForm, ao.Name, True
Next ao

' Hide all reports
For Each ao In CurrentProject.AllReports
Application.SetHiddenAttribute acReport, ao.Name, True
Next ao

' Hide all queries
For Each ao In CurrentData.AllQueries
Application.SetHiddenAttribute acQuery, ao.Name, True
Next ao

' Hide all macros
For Each ao In CurrentProject.AllMacros
Application.SetHiddenAttribute acMacro, ao.Name, True
Next ao

Note that queries and tables belong to the CurrentData object, not the
CurrentProject object.
 
J

Jerry Whittle

Just hide the database windonw and you get the tables and modules hidden to.
Bonus!

I'd rather have the tables hidden more than the forms and reports. BTW: If
the goal is to keep people from messing with form and report design, convert
the database to an MDE.
 
S

storrboy

WARNING!!!
Hidden objects may be removed from project on compression without warning!!!

I've never encountered this problem.
Are there certain conditions or scenarios you know of, or is it random?
 
V

Vladimír Cvajniga

Try to set table.Attributes = 0 and then compact database.
Good luck with backuping your database before you try this.

:)

V.
 
V

Vladimír Cvajniga

It seems they have fixed the bug, ie. it's gone in A2002. In A97 you could
have completely destroyed all data in database. I don't trust since then...
;-)

Public Function fncAtt()
Dim db As DAO.Database

Set db = DBEngine.OpenDatabase("D:\db.mdb")
db.TableDefs("tblTable").Attributes = 1
db.Close
Set db = Nothing

DBEngine.CompactDatabase "D:\db.mdb", "D:\dbCompacted.mdb"

Set db = DBEngine.OpenDatabase("D:\dbCompacted.mdb")
db.TableDefs("tblTable").Attributes = 0
db.Close
Set db = Nothing

End Function
 
J

John W. Vinson

I would like to hide all forms, queries, reports, and macros.

Is there a way to select all and hide at one time or I am stuck with
selecting each individual object, right clicking, selecting properties,
selecting hide, closing, and repeat...

Just turn off the entire database window:

Tools... Startup... uncheck Display Database Window.

Of course you must have a form defined in the Startup Form dropdown
(your switchboard form, typically) or the user will just get a blank
screen.

The user (or you) can still press F11 to get the screen back, unless
you turn that off too by unchecking Allow Access Special Keys. You may
also want to come up with and use a custom toolbar, and turn off the
builtin toolbars and menus.

John W. Vinson [MVP]
 
K

Kokanutt

Dirk, thanks for this solution! It is great. I was wondering is there a way
to perform this function from within another DB? I have 2 mde files as Front
Ends for users and I have a seperate mdb file which is my
Administrator/Application Developer front end. From this Admin front end I
am abel to turn off/on Bypass, Update/Refresh linked tables, and change
security access using VBA. Is there a way to perform the
Application.SetHiddenAttribute from within my Admin front end for my two mde
files or even my 2 mdb files. When I need to add/modify/delete objects from
my 2 front ends I do that with the mdb files first then recreate the mdes.
But I don't want to have to do that if I ever need to just take a quick look
at the objects in the mde files for troubleshooting.

Any suggestions?
 
Top