hide all db objects

  • Thread starter Thread starter news.microsoft.com
  • Start date Start date
N

news.microsoft.com

Hi I want to be able to hide all forms, reports and queries from the
database using code

How can I do this?
 
you may try to make them hidden (in object properties dialog), but it si
still possible to see them if user switch on hidden objects
IMHO - no way.
 
Thanks but. . . . I know that they can switch on hidden objects but I am
just trying to make it so people have to work to find things - I can't make
an mde file and I don't want to setup access security.

I can hide them by rc on each individual item but I was trying to avoid
this - is it possible to set this property of the object by code?

If yes what would it be

Thanks
 
news.microsoft.com said:
Hi I want to be able to hide all forms, reports and queries from the
database using code

How can I do this?

In Access 2002 or later -- and maybe Access 2000, I'm not sure -- this
should work:

Dim ao As AccessObject

For Each ao In CurrentProject.AllForms
Application.SetHiddenAttribute acForm, ao.Name, True
Next ao


For Each ao In CurrentProject.AllReports
Application.SetHiddenAttribute acReport ao.Name, True
Next ao


For Each ao In CurrentData.AllQueries
If Left(ao.Name, 3) <> "~sq" Then
Application.SetHiddenAttribute acQuery, ao.Name, True
End If
Next ao
 
Thanks - works a treat
Dirk Goldgar said:
In Access 2002 or later -- and maybe Access 2000, I'm not sure -- this
should work:

Dim ao As AccessObject

For Each ao In CurrentProject.AllForms
Application.SetHiddenAttribute acForm, ao.Name, True
Next ao


For Each ao In CurrentProject.AllReports
Application.SetHiddenAttribute acReport ao.Name, True
Next ao


For Each ao In CurrentData.AllQueries
If Left(ao.Name, 3) <> "~sq" Then
Application.SetHiddenAttribute acQuery, ao.Name, True
End If
Next ao

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)
 
Back
Top