password protect a form

OR! you could just create another table storing usernames and passwords then checking the fields of table values. Its much better doing it this way than having the actual password as a string in VBA code because there could be loads of usernames and password combinations, adding new ones would be a nightmare!
 
ghudson said:
You can not format an Input Box.[/b] You will have to create a custom form if you want to hide the ''keyed'' password with ******.

Hi, I have seen somewhere before some code that enables you to change the character displayed by an input box to be '*', for the purpose of making an input box into a password entry.

I believe I saw it on tek-tips. You may wish to investigate it.
 
I had not tried the code in that link but from reading it I do not see how it hides the keyed characters in an input box since the code is referencing a text box. You can not alter the format of the standard input box.
 
Password Protrect Form

You are correct it doesn't hide the characters but it works great. I've be trying to find a way to hide the charaters for awhile.
 
I use the code form the link as well. It is one of the better ways to secure a form. However, and I mean however, make sure you diable the close button on frmPassword otherwise if you click on the x it closes the form and opens the form that you wanted to secure. Other than that, perfect.
 
This is what I do...

I have created a simple login form which loads on start up.

It has a text box for the username (txusername)
a textbox for the password (txpassword)
a button to login
and a button to exit.

When you click the login button, the following code is run:

password = DLookup("Password", "staff", "username='" & txUsername & "' AND password = '" & txPassword & "'")

If password <> "" And IsNull(password) = False Then
DoCmd.OpenForm "Welcome"
Else
MsgBox "Illegal user"
End If

Then on the welcome screen, do the following code for OnLoad:

Private Sub Form_Load()
On Error GoTo Err_Load

username = Forms![Login]![txUsername]

DoCmd.Close acForm, "Login"

Exit_Load:
Exit Sub
Err_Load:
MsgBox Err.Description
DoCmd.Close acForm, "Welcome"
Resume Exit_Load
End Sub
 

Users who are viewing this thread

Back
Top Bottom