-----Original Message-----
(e-mail address removed)... method how can I use
the shift key for maintainance purposes, as for security I am using windows
login and password that has checked against my security table where I gave
the access rights to different users to different forms, also from the
startup I disable all the menus and the shortcut keys. Is there any way that
I can enable shift key when it is required. As you suggested to have a
separate copy for the database for maintanance but then what will happen to
existing data. For some reason Albert's utility is not working it gives me
an error in the code. so any other options!!!
It is very rare that I ever need to set it back. I usually create a mde;
open the mde and set startup options, disable the shiftkey and distribute.
If I need to change something, I'm doing that in the original mdb where the
shift key isn't disabled.
As for existing data, you should split your database - Have the backend on
the server and give each user a copy of the frontend linked to the backend
tables. Once you have made changes you'd distribute the new frontend to
your users. You shouldn't have everyone using the same copy of the frontend
as you'll likely corrupt the database.
But you can, if you need to, set the shiftkey back from another mdb.
Use the same function with a few modifications:
You'd need to add
Dim wrk As Workspace
then
Set wrk = DBEngine.Workspaces(0)
and change the Set db statement to
Set db = wrk.OpenDatabase("path to mdb")
Then change this line
Set prop = db.CreateProperty("AllowByPassKey", dbBoolean, False, True)
to
Set prop = db.CreateProperty("AllowByPassKey", dbBoolean, True, True)
--
Joan Wild
Microsoft Access MVP
.
I have been looking for a solution myself...It seems
that you can only reset the startup properties on exit.
So If an administrator logs in, I set them to reset the
properties to True when an admin exits. The admin has to
log in twice to get the properties. BUT...you CAN't
forget to turn everything off from the MENU ONLY
(Tools/Startup) if you are going to distribute the front
end. Otherwise, if the admin was the last person to
exit, the other users will have full access.
Here is my code (call this procedure when user exits the
database):
Sub SetStartupProperties()
'(TorF As Boolean)
'Const DB_Text As Long = 10
Const DB_Boolean As Long = 1
ChangeProperty "StartupForm", DB_Text, "F_MainForm"
ChangeProperty "StartupShowDBWindow", DB_Boolean, False
If CurrentUserInGroup("Admins") = True Then
'Set these to True for Admins
ChangeProperty "StartupShowStatusBar", DB_Boolean,
True
ChangeProperty "AllowBuiltinToolbars", DB_Boolean,
True
ChangeProperty "AllowFullMenus", DB_Boolean, True
ChangeProperty "AllowBreakIntoCode", DB_Boolean, True
'(F11 Key)
ChangeProperty "AllowSpecialKeys", DB_Boolean, True
'Key that allows you to bypass AutoExec macro (SHIFT
KEY)
ChangeProperty "AllowBypassKey", DB_Boolean, True
Else
'Set these to False for everyone else
ChangeProperty "StartupShowStatusBar", DB_Boolean,
False
ChangeProperty "AllowBuiltinToolbars", DB_Boolean,
False
ChangeProperty "AllowFullMenus", DB_Boolean, False
ChangeProperty "AllowBreakIntoCode", DB_Boolean, False
'(F11 Key)
ChangeProperty "AllowSpecialKeys", DB_Boolean, False
'Key that allows you to bypass AutoExec macro (SHIFT
KEY)
ChangeProperty "AllowBypassKey", DB_Boolean, False
End If
End Sub
'I got this code from the help files:
Function ChangeProperty(strPropName As String,
varPropType As Variant, varPropValue As Variant) As
Integer
Dim dbs As Object, prp As Variant
Const conPropNotFoundError = 3270
Set dbs = CurrentDb
On Error GoTo Change_Err
dbs.Properties(strPropName) = varPropValue
ChangeProperty = True
Change_Bye:
Exit Function
Change_Err:
If Err = conPropNotFoundError Then ' Property not
found.
Set prp = dbs.CreateProperty(strPropName, _
varPropType, varPropValue)
dbs.Properties.Append prp
Resume Next
Else
' Unknown error.
ChangeProperty = False
Resume Change_Bye
End If
End Function