Chris,
Thanks for the link below. I think that it will help me however I am having
problems with 1-2 lines of the code.
I am having problems with the line of code that states:
If Me.txtPassword.Value = DLookup("Password", "Login", "[lngUserID]=" &
Me.cboLogin.Value) Then
lngMyEmpID = Me.cboLogin.Value
and the fact that you are told to place this line of code in a module:
Public lngMyEmpID As Long
I am not familiar with modules so I would appreciate some advice on how to
create one. Additionally, the entire code that was written for the form is
listed below. Perhaps you (or someone else can read it) and help me to
understand the If statement that I mentioned above (step by step advice
please)
Private Sub cmdLogin_Click()
'Check to see if data is entered into the UserName combo box
If IsNull(Me.cboLogin) Or Me.cboLogin = "" Then
MsgBox "You must enter a User Name.", vbOKOnly, "Required Data"
Me.cboLogin.SetFocus
Exit Sub
End If
'Check to see if data is entered into the password box
If IsNull(Me.txtPassword) Or Me.txtPassword = "" Then
MsgBox "You must enter a Password.", vbOKOnly, "Required Data"
Me.txtPassword.SetFocus
Exit Sub
End If
'Check value of password in Login table to see if this
'matches value chosen in combo box
If Me.txtPassword.Value = DLookup("Password", "Login", "[lngUserID]=" &
Me.cboLogin.Value) Then
lngMyEmpID = Me.cboLogin.Value
'Close logon form and open splash screen
DoCmd.Close acForm, "frmLogon", acSaveNo
'DoCmd.OpenForm "frmSplash_Screen"
Else
MsgBox "Password Invalid. Please Try Again", vbOKOnly, "Invalid Entry!"
Me.txtPassword.SetFocus
End If
'If User Enters incorrect password 3 times database will shutdown
intLogonAttempts = intLogonAttempts + 1
If intLogonAttempts > 3 Then
MsgBox "You do not have access to this database.Please contact admin.",
vbCritical, "Restricted Access!"
Application.Quit
End If
End Sub
Chris B via AccessMonster.com said:
Ron,
Klatuu explained quite well above on how to do this,
There is a sample database with a login form at
http://www.databasedev.co.uk/downloads.html
Look for "example of login form"
Maybe it could help to show where the codes all go?
HTH
ron said:
Klatuu,
I am trying to creat the same password for a form. I am just getting started
in learning codes. So I am at a lost at how this works. could you give me
step by step instructions on how to do this. I understand how to create
forms in access.
Or is there a site that can help me with adding code to create a password
for a single form.
thanks
[quoted text clipped - 92 lines]