simple password form

tru-

Registered User.
Local time
, 17:32
Joined
Jan 29, 2006
Messages
18
Code:
Private Sub btnConfirm_Click()
    On Error Resume Next
    DoCmd.Close acForm, Me.Name
End Sub

Private Sub Form_Unload(Cancel As Integer)
    Dim password As String
 
    password = "closeme"
 
    If enterpassword <> password Then
        Cancel = -1
        MsgBox "Incorrect password!", vbExclamation
    End If
End Sub

It works except if I press the confirm button with no text entered into the box it'll act as if the password is correct, wheres the simple error?
 
password form

Tru,

I have attached a fairly simple password form for you to have a look at. This set up stores the passwords for individual users in its own table. When a user enters their ID and password the code looks for a matching record. If a matching record is found it lets the user in if not the user is denied access.

I have found this method better than storing a single password in a string, that all users will need to know.

You can modify this to create a log table which will store the details of when people logged in etc.

hope it helps

regards
ian
 

Attachments

Anyone willing to save attachment in 97 format?

Hello, would anyone be kind enough to save the file Ian posted here into an access 97 format & upload it here? as I cant view it due to having access 97 :-(
& cant find any other sampes of password protection on forms that im able to view in these forums.

.....or any other example of using usernames & password stored in a table to secure a form in 97 format would be excellent.

Regards

Kevin
 
try
Code:
If Nz(enterpassword) <> password Then

Once you have gotten this idea down, then creating your own user level password is easy :) You use exactly the same principle, just instead of the password being haod coded, it is stored in the DB, and you find a users password by doing a select query when the button is clicked :)
 
A97 password form

Kevin ive converted the the file to A97 for you.

hope it helps.

regards
ian
 

Attachments

do somebody knows with what VBA you give into
to editor, that the on click function can make a difference
between small and capital letters. because when my password
is in small letters and i put in capitals, he does accept it also...
how can i solve this?

Greetz

veerle
 
Thanks Ian for coverting to 97 format & posting, thats a great help, it doesnt work properly at the mo but think i can use elements of your code & edit to help me.

And thanks workmad3 for providing that example

Cheers ;)

Kevin
 

Users who are viewing this thread

Back
Top Bottom