How alter onclick event of code for first time login
Posted on 2014-01-20
I have the following code in an onclick event of a login form. But I need to alter it so that in the event the user is logging in for the first time they will be taken to a separate form to enter their new login of choice. Then after they have entered their new login be taken back to the original form to continue. How do I alter the following code?
'Check to see if data is entered into the Password combo box
If IsNull(Me.txtPassword) Or Me.txtPassword = "" Then
MsgBox "You must enter a Password.", vbOKOnly, "Required Data"
'Check value of password in tblEmployees to see if this matches value chosen in combo box
If Me.txtPassword.Value = DLookup("Password", "tblEmployees", "[EmployeeID]=" & Me.cboName.Value) Then
myempid = Me.cboName.Value
Dim rs As DAO.Recordset
Set rs = CurrentDb.OpenRecordset("LOCALtblLogin")
rs!FullName = Me.txtFullName
rs!EmployeeID = Me.txtLoginID
rs!DateTime = Now()
rs!SecurityLevel = Me.txtSecurityLevel
'Close logon form and open splash screen
DoCmd.Close acForm, "frmLogin", acSaveNo
MsgBox "Password Invalid. Please Try Again", vbCritical + vbOKOnly, "Invalid Entry!"
'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 your system administrator.", vbCritical, "Restricted Access!"