Password protect a textbox or form

  • Thread starter Thread starter Peter MacInnis
  • Start date Start date
P

Peter MacInnis

Good day, I would like to password protect a single
textbox on a form. On my database form there is going to
be a textbox that only one person is allowed to use. I
don't want anyone else to access it. The other option is
to make a new form that has the textbox for that person
and password protect the form. Either method would be
suitable. Thanks.


Peter MacInnis
250-363-1240
 
I would add an event procedure to the OnEnter property of the text box (let's call it text1) like:

Sub ProtectText1()
Dim myPassword as String

myPassword=Inputbox "What is the password?"
If myPassword = "joe" Then
text1.locked=false
text1.setfocus
Else
Msgbox "Incorrect password"
text1.locked=true
text2.setfocus
End Sub

Hope this helps
Cathi Payne
 
Back
Top