Private Sub cmdlogin_Click()
Dim dbs As Database
Dim rstUserPwd As Recordset
Dim CustMatch As Boolean
Dim EmployMatch As Boolean
Dim AdminMatch As Boolean
Dim rstCustPwd As Recordset
Set dbs = CurrentDb
Dim loadInfo As Recordset
Set rstUserPwd = dbs.OpenRecordset("qryEmplyLogin")
Set rstCustPwd = dbs.OpenRecordset("qryCustLogin")
Set loadInfo = dbs.OpenRecordset("VIEW ALL")
CustMatch = False
EmployMatch = False
AdminMatch = False
If rstUserPwd.RecordCount > 0 Then
rstUserPwd.MoveFirst
'check for matching records
Do While rstUserPwd.EOF = False
If rstUserPwd![LoginName] = Form_frmLogin.txtusername.Value And rstUserPwd![Login Password] = Form_frmLogin.txtpassword.Value And rstUserPwd![Admin] = True Then
AdminMatch = True
Form_frmLogin.cmdlogin.SetFocus
Exit Do
ElseIf rstUserPwd![LoginName] = Form_frmLogin.txtusername.Value And rstUserPwd![Login Password] = Form_frmLogin.txtpassword.Value Then
EmployMatch = True
Form_frmLogin.cmdlogin.SetFocus
Exit Do
End If
rstUserPwd.MoveNext
Loop
End If
If rstCustPwd.RecordCount > 0 Then
rstCustPwd.MoveFirst
Do While rstCustPwd.EOF = False
If rstCustPwd![Login Name] = Form_frmLogin.txtusername.Value And rstCustPwd![Internet Banking Password] = Form_frmLogin.txtpassword.Value Then
CustMatch = True
Form_frmLogin.cmdlogin.SetFocus
Form_frmCustHome.lblcustname.Caption = loadInfo![Customer Full Name][COLOR="Yellow"]Somewhere here. The above just adds whatever the first line of data is, how do i view the data that i have logged in with?[/COLOR]
Exit Do
End If
rstCustPwd.MoveNext
Loop
End If
If AdminMatch = True Then
'open the next form here and close this one
DoCmd.Close acForm, Me.Name
DoCmd.OpenForm "Interface_Admin"
ElseIf EmployMatch = True Then
DoCmd.Close acForm, Me.Name
DoCmd.OpenForm "Interface_Emplyee"
ElseIf CustMatch = True Then
DoCmd.Close acForm, Me.Name
DoCmd.OpenForm "Interface_Customer"
Else
MsgBox "Incorrect Username or Password. Please Retry.", , "Login"
Form_frmLogin.txtpassword.SetFocus
End If
End Sub
Private Sub Detail_Click()
End Sub
Private Sub Form_Current()
End Sub