ppkgoldengun
MIS
All,
The following code is part of a button command on a sign-in form. In addition to the password routine I need to count the connects to the backend DB. Before I write the connects test routine I have tested just looking at the number of connects. When the form is first opened (MODAL POPUP), a breakpoint will show that one user is connected (this is correct). After this code is executed and the frmMainswithboard is open a break will show two connects both the same machine and log-in. Any clues?
My code:
Private Sub btnContinue_Click()
On Error GoTo Err_btnContinue_Click
'EMPLOYEE LOGIN
'VERIFY THAT AN EMPLOYEE HAS BEEN SELECTED
If IsNull(Me.cmbEmployee) Then
MsgBox "You must select an employee name."
Me.cmbEmployee.SetFocus
Exit Sub
End If
'VERIFY THAT A PASSWORD HAS BEEN ENTERED
If IsNull(Me.txtPassword) Then
MsgBox "You must enter your password."
Me.txtPassword.SetFocus
Exit Sub
End If
'VALIDATE PASSWORD
If Me.txtPassword = Me.cmbEmployee.Column(3) Then
'Save UserID to global variable for further use
UserID = Me.cmbEmployee.Column(4)
DoCmd.Close
DoCmd.OpenForm "frmMainSwitchboard"
Else
'PASSWORD VALIDATION FAILED
MsgBox "Invalid password. Please try again."
Me.txtPassword.SetFocus
Exit Sub
End If
Exit_btnContinue_Click:
Exit Sub
Err_btnContinue_Click:
MsgBox Err.Description
Resume Exit_btnContinue_Click
End Sub
The following code is part of a button command on a sign-in form. In addition to the password routine I need to count the connects to the backend DB. Before I write the connects test routine I have tested just looking at the number of connects. When the form is first opened (MODAL POPUP), a breakpoint will show that one user is connected (this is correct). After this code is executed and the frmMainswithboard is open a break will show two connects both the same machine and log-in. Any clues?
My code:
Private Sub btnContinue_Click()
On Error GoTo Err_btnContinue_Click
'EMPLOYEE LOGIN
'VERIFY THAT AN EMPLOYEE HAS BEEN SELECTED
If IsNull(Me.cmbEmployee) Then
MsgBox "You must select an employee name."
Me.cmbEmployee.SetFocus
Exit Sub
End If
'VERIFY THAT A PASSWORD HAS BEEN ENTERED
If IsNull(Me.txtPassword) Then
MsgBox "You must enter your password."
Me.txtPassword.SetFocus
Exit Sub
End If
'VALIDATE PASSWORD
If Me.txtPassword = Me.cmbEmployee.Column(3) Then
'Save UserID to global variable for further use
UserID = Me.cmbEmployee.Column(4)
DoCmd.Close
DoCmd.OpenForm "frmMainSwitchboard"
Else
'PASSWORD VALIDATION FAILED
MsgBox "Invalid password. Please try again."
Me.txtPassword.SetFocus
Exit Sub
End If
Exit_btnContinue_Click:
Exit Sub
Err_btnContinue_Click:
MsgBox Err.Description
Resume Exit_btnContinue_Click
End Sub