Password Protect one Field

  • Thread starter Thread starter junkgrrl
  • Start date Start date
J

junkgrrl

I would like to password protect our NAME field in our database so it's not
visible to everyone who has access to it with the exception of a few people.
There are 21 fields total on our form. We're using Access 2003. Those who are
allowed to view this field could use the same password.

I've read that this is possible but I can't seem to have any luck. I've
tried putting the codes in, adding buttons. and it's not working.

What am I doing wrong? What should I do first? How should I set this up
without messing up our database with 3500 people?

Thanks
 
junkgrrl said:
I would like to password protect our NAME field in our database so it's not
visible to everyone who has access to it with the exception of a few
people.
There are 21 fields total on our form. We're using Access 2003. Those who
are
allowed to view this field could use the same password.

I've read that this is possible but I can't seem to have any luck. I've
tried putting the codes in, adding buttons. and it's not working.

What am I doing wrong? What should I do first? How should I set this up
without messing up our database with 3500 people?

Thanks

You'd have to set up user level security and user the CurrentUser function
to determine who's logged to and set the surname text box's visible property
accordingly. Not an easy task if you've never done it before.

Keith.
www.keithwilby.co.uk
 
A real simple solution is to create a little popup form for password entry,
with a textbox and label. The label caption reads "Enter Password". The
textbox input mask is set to Password.

Now, on your main form, set the name field visible property to false. Add a
label that is captioned "Name", and add a click event to the label:
(my password form is called frmPW)

if me.text1.visible= false then 'text1 is the name of my
textbox -substitute yours
DoCmd.openform "frmPW", acNormal, , , , acDialog
end if
This opens the password form and allows the user to enter the correct
password.

In the textbox before update event of the password form, put this code:

Private Sub txtInput_BeforeUpdate(Cancel As Integer)
If Me.txtInput = "XYZ" Then
Forms!form2.Form!Text1.Visible = True
DoCmd.Close acForm, "frmPW"
Else
Me.lblInput.Caption = "Try Again"
End If
End Sub

Note that I called this a simple solution. The password in my example is
hardcoded, for instance. Also, the form allows unlimited tries. You could
add a counter to limit the tries if you wanted.

Damon
 
Back
Top