Hey guys
I want to create a secure log in/ clock in / out form where different employees could log in and be automatically directed to there correct form. I have tried to create one but i keep getting "run time error 3011"
Dim WithEvents kell As Timer
Private Sub cmdin_Click()
'authenticate with a database
Me.Data1.RecordSource = "select * FROM [EmployeeClock] WHERE [EmployeeID] = '" & Me.txtin & "'"
Me.Data1.Refresh
Select Case Data1.Recordset.RecordCount
Case Is < 1 'no record found
MsgBox "Not an Employee", vbCritical + vbOKOnly, "user error"
GoTo tidyform
Case Is > 1 'record found
If Data1.Recordset.Fields(1).Value = Me.txtpass.Text Then
Select Case Data1.Recordset.Fields(2).Value
Case "Mechanic"
Load frmmech
frmmech.Show
Case "Receptionist"
Load frmAdmin
frmAdmin.Show
Case "Driver"
Load frmmechanic
frmmechnic.Show
Case Else
MsgBox "Your Have Not Been Set A Role Please Contact Administrater"
End
End Select
Unload Me
Else
MsgBox "Tra", vbCritical + vbOKOnly, "bye!"
GoTo tidyform
End If
End Select
Exit Sub
tidyform:
Me.txtin.Text = Empty
Me.txtout.Text = Empty
Me.txtin.SetFocus
End Sub
Private Sub Form_Load()
strSQL = Me.Data1.DatabaseName = App.Path & "\EmployeeListlog.mdb"
End Sub
Private Sub Timer1_Timer()
lbltime.Caption = Format$(Time, "hh:mm:ss AM/PM")
lbldate.Caption = Format$(Now, "dd, mm dd, yyyy")
End Sub