You REALLY should not allow your users to have access to anything but
an MDE version. Here is how we control access to forbidden features
in the MDE:
ChangeProperty "StartupShowDBWindow", dbBoolean, False
ChangeProperty "StartupShowStatusBar", dbBoolean, True
ChangeProperty "AllowBuiltinToolbars", dbBoolean, False
ChangeProperty "AllowFullMenus", dbBoolean, False
ChangeProperty "AllowBreakIntoCode", dbBoolean, False
ChangeProperty "AllowSpecialKeys", dbBoolean, False
ChangeProperty "StartupShowDBWindow", dbBoolean, False
ChangeProperty "AllowShortcutMenus", dbBoolean, False
' Change this one to false just prior to MDE creation:
ChangeProperty "AllowBypassKey", dbBoolean, True
Here is the "ChangeProperty" Sub:
Function ChangeProperty(strPropName As String, varPropType As Variant,
_
varPropValue As Variant) As Integer
Dim dbs As Database
Dim prp As Property
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, True)
dbs.Properties.Append prp
Resume Next
Else
' Unknown error.
ChangeProperty = False
Resume Change_Bye
End If
End Function
If you do the above in a basGlobal module, you users will not have
access to any of the forbidden objects.
On 20 Feb 2006 09:01:05 -0800,
(E-Mail Removed) wrote:
>I am working on a database that I will developing while it's being
>used. There are things I'd like to do to keep users out of areas they
>shouldn't be in (such as disabling autoexec bypass, hiding the database
>window, toolbars, etc.), but when I'm working on a database and
>frequently saving it as an in-production mde, these things can be an
>inconvenience for me. I keep the mdb on my local computer, then save
>an mde of it to a shared network folder (which then gets copied
>automatically to individual workstations by Tony Toews' Auto FE
>Updater). I wanted to be able to update the whole process, so I could
>have a hidden button that would programmatically set all these
>attributes, save it as an mde, then switch them back in my mdb. But it
>seems that the automated way of saving an mde can't be used on the
>current database. Is there a command to determine whether or not the
>current db is an mde vs. an mdb? Perhaps I could use that to set these
>attributes, since I'm the only one who will be working in the mdb.
>
>Anyone have any tips they want to share in making this a little easier?
>
>Thanks!