password

laurat

Registered User.
Local time
Today, 22:54
Joined
Mar 21, 2002
Messages
120
I have a button on a form that opens another form. However, a password must be entered before this form will open. The code was placed in the On_Click event of the button:

Dim x
x = InputBox("Enter Password", "Password")
If x = "acct2001" Then GoTo DisEntry
MsgBox ("Incorrect Password, Disposition Form Will Not Open")
GoTo EndPass

DisEntry:
Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Disposition Entry"
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Command107_Click:
Exit Sub

Err_Command107_Click:
MsgBox Err.Description
Resume Exit_Command107_Click
EndPass:

The problem is that when the password is typed in, the actual letters come up. Is there code I can add that will make the password be astericks when the user types it in??
 
Use a popup form instead of an input box.

A text field on a popup form can have the "Password" input mask. An Input Box cannot.
 
If you have time, can you explain a little further how to incorporate a password with a pop up form.

Thank you.
 
You'll move part of your code to the popup form

Basically how it will work is like this:

Current form button:
Code:
DoCmd.OpenForm "PopupFormName"
Popup form will have at least the Password field, masked, and a button to OK (maybe one to cancel?). In the OK button:
Code:
  If Me.PasswordBox <> "acct2001" Then
    MsgBox ("Incorrect Password, Disposition Form Will Not Open")
    DoCmd.Close 'Close the popup form
    'maybe DoCmd.Close "OriginalForm" as well?
  Else 
    DoCmd.OpenForm "Disposition Entry"
    DoCmd.Close "PopupFormName" 'have to name specifically since you opened another form
  End If
Keep in mind that you'll have to lock people out of your code to make sure they can't see your password stored here.
 

Users who are viewing this thread

Back
Top Bottom