password for 1 form

vivian

Registered User.
Local time
Today, 07:00
Joined
Aug 9, 2002
Messages
115
this may be a silly question, but i'm getting frustrated with the security for our database. the security wizard is difficult to use, and i simply want one form secured from all but 3 people. is there a way to put a password on that form using a macro, and if so how. i need to have this done fairly quickly, so any help is much appreciated.

thanx much
 
ps, sorry, i'm really aweful at the visual basic stuff so i'd like to steer clear of that. thanks again
 
I know you said you don't like CODE, but....
This is such an easy fix, I'll just throw it out there and you can do what you want with it.

In the On Open Event of the Form, enter this...
Code:
  Dim pwd As String
  pwd = InputBox("What is the Password?")
  If pwd = "HocusPocus" Then
     MsgBox "You're In"
  Else
     MsgBox "Nice Try Wise Guy, You're Out!!"
     DoCmd.Close
  End If

In the line, --- If pwd = "HocusPocus" Then ---
Simply change the "HocusPocus" part to your desired password.
This will not let people open the form who do not have the password.

Pretty clever, eh?!
 
thanks

that worked great ! the other question i then have is, how do i get the password to look like the ***** on the screen when being entered?

thanks for the help
 
You can not format an input box. If you need the extra security of displaying ********
instead of the typed password then you will have to create a form and format the text box
as a password.

You will not be able to do what you want without getting your hands dirty with VBA. ;)

HTH

This is how I use an input box to password protect a command button...

Code:
    Dim strInput As String
    Dim strMsg As String
    
    Beep
    strMsg = "This form is used only by the ''Special Form'' people." & vbCrLf & vbLf & "Please key the ''Special Form'' password to allow access."
    strInput = InputBox(Prompt:=strMsg, title:="Inventory Audit Password")
    If strInput = "SpecialFormPassword" Then 'password is correct
        DoCmd.OpenForm "YourSpecialFormNameHere"
        DoCmd.Close acForm, Me.Name
    Else 'password is incorrect
        MsgBox "Incorrect Password!" & vbCrLf & vbLf & "You are not allowed access to the ''Special Form''.", vbCritical, "Invalid Password"
        Exit Sub
    End If
You can not format an input box!

HTH
 
If you want to use ****, then you will have to add another form which opens before the protected form. On this new form insert a text box (name it txtPwd) with the Input mask set to Password.
Add a button that checks to see if the value entered in the text box is equal to the assigned password. If it is, then open the secure form, if not, then don't open it.


Private Sub EnterBut_Click()

If Me.txtPwd = "HocusPocus" Then
MsgBox "You're In"
DoCmd.OpenForm "SecureFormName"
Else
MsgBox "Nice Try Wise Guy, You're Out!!"
End If

End Sub

Make sure you name the button EnterBut
 

Users who are viewing this thread

Back
Top Bottom