Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Security / June 2007

Tip: Looking for answers? Try searching our database.

Hide all access objects at once

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Song Su - 27 May 2007 16:49 GMT
Access 2003; Windows XP

I disabled shift key for my frontend .mde. However, user still can create a
blank mdb and link to/import from my FE .mde tables which linked to BE mdb.

I want to hide tables and queries object in my FE .mde but I can only do one
object at a time (right click the object, property, hide). I have so many
tables and queries. Is it an easy way to hide them all at once?

thanks.
Barry Edmund Wright - 07 Jun 2007 03:49 GMT
Create a form called frmUtils and put a single button on it. In the
"On Click" event put the following:
=HidDBObjects()

In a code module put the following code:

Public Function HidDBObjects()
On Error GoTo Err_HidDBObjects

Dim vHid As Boolean
Dim vAnswer As String

vAnswer = MsgBox("Select ""Yes"" to Hid All DB Objects; Select ""No""
to Unhid All DB Objects!", vbQuestion + vbYesNoCancel, "Hid All DB
Objects")
If vAnswer = vbYes Then
 vHid = True
ElseIf vAnswer = vbNo Then
 vHid = False
ElseIf vAnswer = vbCancel Then
 Exit Function
End If

Application.Echo False
HourGlass_On

 If IsLoaded("frmUtils") = True Then
   DoCmd.Close acForm, "frmUtils", acSaveYes
 End If

 HidTables vHid
 HidFormsReportsMacros vHid

Application.Echo True
HourGlass_Off

Exit_HidDBObjects:
   Exit Function

Err_HidDBObjects:
   MsgBox Err.Description
   Resume Exit_HidDBObjects

End Function

Public Function HidFormsReportsMacros(vbln As Boolean)

'Hids/Unhids all the forms, reports and macros in the database.
 Dim obj As AccessObject
 Dim dbs As Object
 Set dbs = Application.CurrentProject

 For Each obj In dbs.AllForms
   Application.SetHiddenAttribute acForm, obj.Name, vbln
 Next obj
 For Each obj In dbs.AllReports
   Application.SetHiddenAttribute acReport, obj.Name, vbln
 Next obj
 For Each obj In dbs.AllModules
   Application.SetHiddenAttribute acModule, obj.Name, vbln
 Next obj
 For Each obj In dbs.AllMacros
   Application.SetHiddenAttribute acMacro, obj.Name, vbln
 Next obj

 Set dbs = Application.CurrentData
 For Each obj In dbs.AllQueries
   Application.SetHiddenAttribute acQuery, obj.Name, vbln
 Next obj

End Function

Public Function HidTables(vbln As Boolean)

 Dim db As Database
 Dim T As TableDef
 Dim TName As String
 Dim I As Integer
 Dim vCnt As Integer

 Set db = CurrentDb()

'Code below Hids or UnHids all non-system tables in a database.
 For I = 0 To db.TableDefs.Count - 1
   Set T = db.TableDefs(I)
   TName = T.Name
   If Not TName Like "msys*" Then
     Application.SetHiddenAttribute acTable, TName, vbln
     vCnt = vCnt + 1
   End If
 Next I

End Function

> Access 2003; Windows XP
>
[quoted text clipped - 6 lines]
>
> thanks.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.