Setting user-dependent allowbypasskey on secured backend

S

Sietske

First some context:

I have split my database into a front end and a back end, the "admin" is
removed from the "admins" workgroup and the group "users" doesn't have any
rights. I've created a new "normal user" workgroup for normal users.

Normal users fill the back end by using the forms of the front end. The back
end only shows a "no trespassing" start up screen when it is entered
directly. However, in the current situation, the normal users can still enter
the tables of the back end using their password and the shift key, and edit
data in the main table directly.

To avoid this, I would like to disable the shift key bypass, but only for
normal users and not for people in the "admins" workgroup.


Now my problem:
I have put the function to set the AllowBypassKey from the MS Access
Security FAQ (question 27) in the immediate window, but that isn't enough, is
it? Do I have to put the Create Property syntax (or something else) somewhere
else also? And what do I have to fill in then? I've read
http://www.mvps.org/access/general/gen0040.htm and tried to understand old
postings on this newsgroup, but it was still not clear to me.

Besides this, I would like some information about what that particular
function from the MSA Security FAQ does exactly, because I don't feel right
about just copying code without knowing what it does. Is there a clear
website or paper related to it?
 
S

Sietske

Yes, it works! For others with the same problem who read this topic and want
to know what I did:

First I made a module containing the code on
http://www.mvps.org/access/general/gen0040.htm

I called the code just once using the immediate window by Ctrl-G and then
typing

ChangeProperty "AllowBypassKey", dbBoolean, True
(followed by <ENTER>)

I've tested if the value of the property AllowBypassKey was currently "True"
by typing
MsgBox CurrentDb.Properties("AllowByPassKey")
(followed by <ENTER>)

What I now wanted to do is letting the administrator set the value of
AllowBypassKey each time he or she left the database. In the main form of my
database I therefore included the following:

Private Sub Form_Close()
Const dbBoolean As Long = 1

If CurrentUser = "MyAdmin" Then

Dim strMsg As String
strMsg = "You are now logged in as MyAdmin."
strMsg = strMsg & "Do you want to allow the shift key, next time the
database is started?"

Select Case MsgBox(strMsg, vbQuestion + vbYesNo, "Shift-key?")

'Note that properties can only be changed
'when the defined administrator is logged in
'because the fourth (DLL) parameter in the create property syntax
'is set to "True"

Case 6 '=vbYes
ChangeProperty "AllowBypassKey", dbBoolean, True
Case 7 '=vbNo
ChangeProperty "AllowBypassKey", dbBoolean, False
End Select

Else
' No message shown for other users

End If

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top