Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

password on button click

Status
Not open for further replies.
Feb 25, 2005
30
GB
Hi,
Could anybody help with the issue of how to place a password on a button within a form. I have no security groups etc so no need to check to such detail. I just need to protect a form from a few users (the database only has 5 users) so thought a password on a button would do.

Any help would be greatly appreciated.

regards
Rob
 
Hi
This is not very secure at all, but will protect against some tampering if you password protect your code.
Put "If Check_Manager = True Then ..." in the OnOpen event of your form, and cancel the event if it is not true. This is Check_Manager:
Code:
Function Check_Manager()
Dim vPass, vResponse
'Static password, more to slow the user down than anything else.
' What you put in here depends on other factors. If anyone
' can get at tables, you may wish to hardcode a password
' eg vPass="ffffff11111"
vPass = DLookup("Password", "Company")

vResponse = InputBox("Enter your password:", "Password")

If vResponse = "" Then
'No password, ie cancel
    Check_Manager = False
Else
    If vResponse = vPass Then
        Check_Manager = True
    Else
        'Wrong password
        MsgBox "Incorrect Password", vbExclamation, "Password"
        Check_Manager = False
    End If
End If
 
Thanks Remou your advice works great, much appreciated.

Rob.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top