M
Mr.Kane
Here si my dilemma:
I am creating a login screen for a small Access based app.
There is a combobox control where a user can select their name
and then they are required to enter a password (I have this set to a
default string currently)
The user then enables an "OK" command button whose "On Click" event
procedure is coded as the following:
Private Sub LogIn_OK_Button_Click()
Dim LogIn_ID As String
Dim Staff_ID As Single
'Check to see if data is entered into the UserName combo box
If IsNull(Me.LogIn_ID) Or Me.LogIn_ID = "" Then
MsgBox "You must enter a User Name.", vbOKOnly, "Required Data"
Me.LogIn_ID.SetFocus
Exit Sub
End If
'Check to see if data is entered into the password box
If IsNull(Me.LogIn_PW) Or Me.LogIn_PW = "" Then
MsgBox "You must enter a Password.", vbOKOnly, "Required Data"
Me.LogIn_PW.SetFocus
Exit Sub
End If
'Check value of password in Staff to see if this matches value chosen
in combo box
If Me.LogIn_PW.Value = DLookup("Staff_Password", "tblStaff",
"[Staff_ID]"= "Me.LogIn_ID.Value") Then
Staff_Name = Me.LogIn_ID.Value
'Close logon form and open splash screen
DoCmd.Close acForm, "frmFOCUS-PRO Login Screen", acSaveNo
DoCmd.OpenForm "frmFOCUS-PRO (Front End)"
Else
MsgBox "Password Invalid. Please Try Again", vbOKOnly, "Invalid Entry!"
Me.LogIn_PW.SetFocus
End If
End Sub
"LogIn_PW" is the password text box control
"LogIn_ID" is the Username Combobox control
When the command button is clicked it returns the message "Password
Invalid. Please Try Again"
I'm sure that I have missed something obvious in my code. The procedure
isn't comparing the correct values to hose found in my "Security" Table
"Security" Table structure:
Staff_ID Staff_Name Team_ID Staff_Password
Btw the query that is feeding the LogIn_ID combobox it's values is
SELECT DISTINCT Security_Staff.Staff_Name, Min(Security_Staff.Staff_ID)
AS MinOfStaff_ID
FROM Security_Staff
GROUP BY Security_Staff.Staff_Name
ORDER BY Security_Staff.Staff_Name;
Any help would be appreciated
I am creating a login screen for a small Access based app.
There is a combobox control where a user can select their name
and then they are required to enter a password (I have this set to a
default string currently)
The user then enables an "OK" command button whose "On Click" event
procedure is coded as the following:
Private Sub LogIn_OK_Button_Click()
Dim LogIn_ID As String
Dim Staff_ID As Single
'Check to see if data is entered into the UserName combo box
If IsNull(Me.LogIn_ID) Or Me.LogIn_ID = "" Then
MsgBox "You must enter a User Name.", vbOKOnly, "Required Data"
Me.LogIn_ID.SetFocus
Exit Sub
End If
'Check to see if data is entered into the password box
If IsNull(Me.LogIn_PW) Or Me.LogIn_PW = "" Then
MsgBox "You must enter a Password.", vbOKOnly, "Required Data"
Me.LogIn_PW.SetFocus
Exit Sub
End If
'Check value of password in Staff to see if this matches value chosen
in combo box
If Me.LogIn_PW.Value = DLookup("Staff_Password", "tblStaff",
"[Staff_ID]"= "Me.LogIn_ID.Value") Then
Staff_Name = Me.LogIn_ID.Value
'Close logon form and open splash screen
DoCmd.Close acForm, "frmFOCUS-PRO Login Screen", acSaveNo
DoCmd.OpenForm "frmFOCUS-PRO (Front End)"
Else
MsgBox "Password Invalid. Please Try Again", vbOKOnly, "Invalid Entry!"
Me.LogIn_PW.SetFocus
End If
End Sub
"LogIn_PW" is the password text box control
"LogIn_ID" is the Username Combobox control
When the command button is clicked it returns the message "Password
Invalid. Please Try Again"
I'm sure that I have missed something obvious in my code. The procedure
isn't comparing the correct values to hose found in my "Security" Table
"Security" Table structure:
Staff_ID Staff_Name Team_ID Staff_Password
Btw the query that is feeding the LogIn_ID combobox it's values is
SELECT DISTINCT Security_Staff.Staff_Name, Min(Security_Staff.Staff_ID)
AS MinOfStaff_ID
FROM Security_Staff
GROUP BY Security_Staff.Staff_Name
ORDER BY Security_Staff.Staff_Name;
Any help would be appreciated