unlocking or re-enabling fields on a form

R

Ron

Is there a way that if a field or button that is locked or
disabled on a form, can be unlocked or enabled with a
certain password that is hard coded? I have specific
fields and buttons (2 each) that need to locked or
disabled for general users, but accessed by users that
have a passcode. The general users still need to have
access to the form and all the other fields on the form
for dataentry and updates. Thanks for the assistance.
 
D

Dirk Goldgar

Ron said:
Is there a way that if a field or button that is locked or
disabled on a form, can be unlocked or enabled with a
certain password that is hard coded? I have specific
fields and buttons (2 each) that need to locked or
disabled for general users, but accessed by users that
have a passcode. The general users still need to have
access to the form and all the other fields on the form
for dataentry and updates. Thanks for the assistance.

Here's example "air code" for a very simple approach to this. It
assumes that a command button is clicked to unlock the form, but you
could as easily have it happen when some particular key combination is
pressed, or some other arcane action is taken:

'---- start of example ----
Private Sub cmdUnlock_Click()

Dim strPassword As String

strPassword = InputBox("Say the secret word:")

If strPassword = "sesame" Then
Me.Textbox1.Locked = False
Me.Textbox2.Enabled = True
Me.Command3.Enabled = True
Me.Command4.Enabled = True
Else
MsgBox "You've got to be kidding!"
End If

End Sub
'---- end of example ----

Bear in mind that, unless you deliver this database as an MDE, there's
nothing to keep the user from viewing the code and finding out the
password. Even in an MDE, you'd want to use some technique for
encrypting the password, to keep out the nosy or determined.

It would be better to use workgroup security, and then enable, disable,
lock, or unlock depending on the security groups the user belongs to.
 

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

Top