Need code to disable unhide database window

  • Thread starter Thread starter Tim
  • Start date Start date
T

Tim

Hi folks,

Could anyone tell me how to gray out (Disable)
the “Unhide…” function under Window tag from a Module?

Thanks in advance.

Tim.
 
sorry, haven't done it in a while. The property has to be added to the
access database once and then it can be turned on & off programmatically.
Here's and example of how to add the property and some others that you may
find useful for turning security on & off.

Dim prp As DAO.Property

Set prp = CodeDb.CreateProperty("StartUpShowDBWindow", 1, 0)
CodeDb.Properties.Append prp

Set prp = CodeDb.CreateProperty("AllowBreakIntoCode", 1, 0)
CodeDb.Properties.Append prp

Set prp = CodeDb.CreateProperty("AllowSpecialKeys", 1, 0)
CodeDb.Properties.Append prp

Set prp = CodeDb.CreateProperty("AllowToolbarChanges", 1, 0)
CodeDb.Properties.Append prp

Set prp = CodeDb.CreateProperty("AllowFullMenus", 1, 0)
CodeDb.Properties.Append prp

Set prp = CodeDb.CreateProperty("AllowBuiltInToolbars", 1, 0)
CodeDb.Properties.Append prp

Set prp = CodeDb.CreateProperty("AllowByPassKey", 1, 0)
CodeDb.Properties.Append prp
 
Steven,

I put the code into a form which will be launch when the
DB startup.

Private Sub Form_Open(Cancel as Integer)

Dim prp As DAO.Property

Set prp = CodeDb.CreateProperty("StartUpShowDBWindow", 1,
0)
CodeDb.Properties.Append prp
CodeDB.Properties ("StartUpShowDBWindow") = False
End Sub

I got an error message "Run-Time error '3367': Can't
append. An object with that name already exists in the
collection."

Am I put the code into the right place?

Thanks.

Tim.
 
You only need to append each property once which you can do manually. In
code, you would either turn it on or off and the value remains set the next
time you open the database. So you don't need to do it every time you open
the database.
codedb.Properties( "StartUpShowDBWindow")= false or true

By the way, this property hides the db window but doesn't disable the hide
menu. You want to use it in combination with the disable special keys (so
they can't use the hot key for the db window) and with the disable
full menus (so they can't unhide it from the menu. You can create custom
menus or forms that you can show if the users needs to use some function on
the menu.

Note, you want to leave yourself a way to turn these off so you can get into
it with full access.

Good Luck
 
Back
Top