Password to open form

Okay, you can't set a password for a form. What about the rest of my question? How to set a pasword on a form.

That's a contradictory question. You wrote, "Okay, you can't set a password for a form...How to set a pasword[sic] on a form"

I think you mean that you can't set a password for a table but how to on a form, eh?

Check this out and see if this doesn't help:
http://www.daniweb.com/code/snippet320.html
 
Password

Thanks for the reply. The discussion on the link (that boblarson supplied) talks about setting a password on a Switchboard menu button. However, in Access 2007 you can always go the "Navigation Pane" to get to the form, which would by-pass the password.

I have found a method to assign a password to an Inputbox, by using this code in an open form event: Cancel = (InputBox("Give password:") <> "MySecretPassword").
However, I have found no way for the user to change the password.

Surely, there must be some way to assign a password to a form and then have a way for the user to change it periodically.

All real suggested solutions are appreciated.

Thanks,
Ron
 
Welcome to the forum!

You need to dump the macro approach and jump into the sea of VBA. User's are also encouraged to search the forum before posting. Your question has been asked and answered in many threads.

You can cheaply and quickly add a function to the OnClick event of your buttons to force the user to input the correct password into an Input Box if they want to access [open a form, report, etc]. You can search this forum for examples of all of the above. The code below will show you how to do it...
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:="Special 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 format an Input Box with astericks **** but it takes a ton of code. Search the forum with the keyword "InputBoxDK" if you really need to do it.

The above is a simple way to call an input box that allows the user to key a password and if correct it will open a form. Assign the code to the OnClick event of the button to open the form that you want password protected.

OK But What abouth If I need to change that password?
How Can I create a form for change this password without enter into the OnClick Process?

Remember the users dont have access to design area.
 

Users who are viewing this thread

Back
Top Bottom