password-protected form

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

Guest

Katherine said:
Is it possible to password protect a form rather than the
entire Database?
Gerald Stanley replied:
Something along the lines of

Private Sub Form_Open(Cancel As Integer)
Const strFormPassword As String = "Password"
If InputBox("Please Enter Password") <> strFormPassword Then
MsgBox "Password Incorrect", vbOKOnly
Cancel = True
End If

I have a commond button on form1 that opens the password-protected form2. If incorrect password is entered, the code above shuts form1 which was opened originally. Can this code be altered in such way that form1 remains open if incorrect password is entered, and possibly with a pop-up message asking to try again?

Sorry that I am not code literate at all. Thanks for any help!
Sam
 
Sam Kuo said:
I have a commond button on form1 that opens the password-protected form2.
If incorrect password is entered, the code above shuts form1 which was
opened originally. Can this code be altered in such way that form1 remains
open if incorrect password is entered, and possibly with a pop-up message
asking to try again?

If the code behind the button is closing Form1 then there has to be a
statement in the code that is doing so. It would look like...

DoCmd.Close (possibly more arguments here)

Just find that line and remove it.
 
How do you clear or reset the password?

Sam Kuo said:
I have a commond button on form1 that opens the password-protected form2. If incorrect password is entered, the code above shuts form1 which was opened originally. Can this code be altered in such way that form1 remains open if incorrect password is entered, and possibly with a pop-up message asking to try again?

Sorry that I am not code literate at all. Thanks for any help!
Sam
 
I'm sorry,
I was using the comments in this thread to password a form in Access 2007.

The code that was suggested works "ok", the password window pops open but
you can see the password as it's typed, not good in most situations and then
the first time you type a password I'm assuming that password is stored.
hidden somewhere. The next time you open the form, the password window opens
and you type in the password. I'd say that's ok but I'm testing and would
like to reset the password, or allow for another password.
I have one person that will be using this form so the one password
limitation is ok in this instance. I would like to learn how to create a
form that requires a user to enter there name & password before the form can
open.

Thank you in advance and I'm hoping I've explained what it is I'm trying to
do.

Don
 
Unless you are using the MDB format, you cannot secure individual objects
using Access security. Even with Access security you cannot require a
password for a single form. What you can do however is determine who the
user is using code like:

http://www.mvps.org/access/api/api0008.htm

Knowing who the user is, can allow you to choose whether or not to allow
him/her to access any objects in the database.

I typically add a hidden table to the database with permission levels for
each user, then store that in a global variable, then check that in the form
load or form open event to see if the user has sufficient permissions to
access that object.
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.accessmvp.com
http://www.mvps.org/access
Co-author: "Access 2010 Solutions", published by Wiley
 
Thank you Arvin for your reply.

I have no coding experience and don't know how to do what your suggesting.

I followed your link to the code that will call for the user name and built
a module for the code to reside in but I have no idea what to do with it now.

This all sounds very difficult to do.

Thanks Arvin

Don
 
Back
Top