Password Protecting a group of fields

J

Jessybloke

Hi,

Ok I have a form with loads of different fields but I have a section that I
require to password protect, every one needs to be able to see them but if an
individual require to update any or all of this particular group they are
required to enter a password, which will allow them to up date all the fields
in this section.

I am a basic user so if you answer please please keep it simple
 
W

Wayne-I-M

Hi

It can't be done. Well it "can" be done very simply BUT anyone with even a
little knowledge of access will be able to get round it (unless you're an
expert coder) so you may want to look at the help files and search on
User-Level Security.

As an example a very simple way of doing what you are looking for would be
to create 2 forms - both the same except that on one you set the controls you
want to proctect as AllowEdits = No. On the other form you can set the
AllowEdits = Yes. The 2nd form you can password protect. The 1st form is
what users will use and the 2nd form is for users who know the password.

There are many ways around this so it depends on how much you really want to
"protect" the controls.

EG.

On your swtichboard create a textbox - call it txtPassword.
Create a button - call it go

Use this OnClick of the go button

Private Sub go_Click()
Static Counter As Integer
If txtPassword = "Wayne" Then
DoCmd.OpenForm "NameOf2ndForm", acNormal, "", "", , acNormal
DoCmd.Close acForm, "SwitchboardName"
Else
If Counter < 2 Then
MsgBox "The password you entered is not correct - try again - MAX 3
ATTEMPTS?", vbOKOnly, "Form entry declined"
Counter = Counter + 1
txtPassword = ""
Else
DoCmd.Quit
End If
End If
End Sub

This will give people only 3 attempts and if they get it wrong 3 times it
will close access. You can remove this section from the code if you want and
give people as many trys as they want.
Of course change the password - unless you want it to be "Wayne".
Change NameOf2ndForm to the real name of the 2nd form
Change SwtichBoardName to the real name of your swtichboard form.

You can improve this be linking it to a table with various passwords and
users details but I think that would be too much effort for something so easy
to get round?

Hope this helps - don't forget that the shift key will get around this code
if people know what they are doing.

Best bet would be User-Level Security
 
Top