put a password on a form

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I need to put a password on a button in a form. Here is what I have done. On
the form, I have the button open another form I called password. On the
password form, I have put in a text field I called password. On the
properties of the text field that is called password I went to the data tab
and set the input mask to "Password". On the Event tab, in the "After Update"
field, I clicked on the "..." to go into the code builder. I put the below
code in and it does not seem to care if I put anything in there. It just will
NOT open up the form called "Admin Form". I know I must be missing something
somewhere. From what I read, this should work. Also, could you give me a hint
as to where or how to easily change the password without having to go into
the code builder(I.E.- a button that says "change password here" sort of
thing)? Thank you in advance. BTW I am using Access 2003 if that means
anything special.

Private Sub Text2_AfterUpdate()
Dim strpwd As String
Const conGoodPwd As String = "studio"
Dim intMaxTries As Integer

For intMaxTries = 1 To 3

If strpwd = conGoodPwd Then 'Good
DoCmd.OpenForm "Admin Form", acNormal
DoCmd.Close
Exit For
End If

Next intMaxTries

End Sub
 
As stated in your OTHER post...

Okay, what prevents them from simply opening that form?

I have never seen a "good" reason to build a password in code in Access.
Use User-Level Security and secure the Admin form. If the user should not
be in it, don't give them access to it. Building a password like you have
includes way too many back doors. What prevents your users from opening the
code and seeing your password? What prevents them from simply opening the
table or the query and viewing or changing the data?

I would recommend (as I always do) building in security properly, using the
tools provided by Access.
 
Rick,
Sorry about posting in many different places. My reasoning for that is at
other message boards I go to if you do not post to multiple groups your
question never gets seen and never answered. At the other boards, visibilty
is the key to getting your questions answered.

On to your questions.
1. The person I am writing the database for wants it that way. No security
but for that form.
2. I am setting up the database so that you can only see the main form. I
know a halfway savvy user can figure it out. But again that is the way the
person wants it.
3. On the main form, they can only see and change the order info, add new
customers, and that's all. The button for the admin form is the only
protected form. The other users cannot see other customers data and cannot
change them only add them.
4. The need for changing that password is a minor requirement but a
necessary one for the person. I know half of everything to all of it could be
covered by setting up the security, but the person does not want that high of
security just enough for a basic sense of it. He might change his mind later,
but I will cross that bridge when I come to it.
5. the only protection I have of these users not opening the code and seeing
everything is the trust of owner and the knowledge that the users are
completely disinclined to knowledge of computers.
 

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

Back
Top