Hi all,
I currently have a table for employees which holds the first name, last name, id, password, and their access level to the database. basically what i want to do is - on start up - have the user enter their employee number and their password. i have the input boxes set up already in another section of the database but i want to move it to the start up (as i already said). when they enter the correct username/password, i want "Welcome, firstName lastName" to apprear in the top of the switchoard. i am just not sure how to get the code to call for the username and then check if the password matches it.
Here is my code for the username and password
Private Sub btnMaintenance_Click()
On Error GoTo Err_cmdbtnMaintenance_Click
'Attached to On Click event of cmdOpenEmpForm
Dim strempID
Dim strPasswd
strempID = InputBox("Enter Employee ID", "Restricted Form")
'Check to see if there is any entry made to input box, or if
'cancel button is pressed. If no entry made then exit sub.
If strempID = "" Or strempID = Empty Then
MsgBox "No Input Provided", vbInformation, "Required Data"
Exit Sub
ElseIf strempID = "XXXXXX" Then
strPasswd = InputBoxDK("Enter Password", "Restricted Form")
Else
MsgBox "Sorry, you do not have access to this form", _
vbOKOnly, "Invalid User"
Exit Sub
End If
If strPasswd = "" Or strPasswd = Empty Then
MsgBox "No Input Provided", vbInformation, "Required Data"
Exit Sub
ElseIf strPasswd = "XXXXXX" Then
DoCmd.OpenForm "Maintenance Form", acNormal
Else
MsgBox "Incorrect Password!", _
vbOKOnly, "OOPS!"
Exit Sub
End If
Exit_cmdBtnMaintenance_Click:
Exit Sub
Err_cmdbtnMaintenance_Click:
MsgBox Err.Description
Resume Exit_cmdBtnMaintenance_Click
End Sub
Help please!
I currently have a table for employees which holds the first name, last name, id, password, and their access level to the database. basically what i want to do is - on start up - have the user enter their employee number and their password. i have the input boxes set up already in another section of the database but i want to move it to the start up (as i already said). when they enter the correct username/password, i want "Welcome, firstName lastName" to apprear in the top of the switchoard. i am just not sure how to get the code to call for the username and then check if the password matches it.
Here is my code for the username and password
Private Sub btnMaintenance_Click()
On Error GoTo Err_cmdbtnMaintenance_Click
'Attached to On Click event of cmdOpenEmpForm
Dim strempID
Dim strPasswd
strempID = InputBox("Enter Employee ID", "Restricted Form")
'Check to see if there is any entry made to input box, or if
'cancel button is pressed. If no entry made then exit sub.
If strempID = "" Or strempID = Empty Then
MsgBox "No Input Provided", vbInformation, "Required Data"
Exit Sub
ElseIf strempID = "XXXXXX" Then
strPasswd = InputBoxDK("Enter Password", "Restricted Form")
Else
MsgBox "Sorry, you do not have access to this form", _
vbOKOnly, "Invalid User"
Exit Sub
End If
If strPasswd = "" Or strPasswd = Empty Then
MsgBox "No Input Provided", vbInformation, "Required Data"
Exit Sub
ElseIf strPasswd = "XXXXXX" Then
DoCmd.OpenForm "Maintenance Form", acNormal
Else
MsgBox "Incorrect Password!", _
vbOKOnly, "OOPS!"
Exit Sub
End If
Exit_cmdBtnMaintenance_Click:
Exit Sub
Err_cmdbtnMaintenance_Click:
MsgBox Err.Description
Resume Exit_cmdBtnMaintenance_Click
End Sub
Help please!