G
Guest
Thanks for giving me this opportunity to seek for a help.
I have a table in my access project called users that contains UserID,
username, and TypeID. I create an unbound form with three test field
(txtUsername, txtPassward and txtTypeid) and two control OK and Cancel
I have two different menu callde AdminMenu and EmpMenu. What I want to
accomplish is when a user enter he or her username, password and typid the
system will read a query called users and determines which form to open.
Please, take a look at the code displayed below. The code only open the
adminmenu. please help me.
----------------------------------------------------------------
Dim MyDb As DAO.Database
Dim rs As DAO.Recordset
Dim Title As String
Title = "Makai-IT"
Dim txtUsername As String
Dim txtPassword As String
Dim txtTypeid As integer
If Me.txtPassword = "" And Me.txtUsername = "" Then
MsgBox "That can not comput"
Exit Sub
Call Clear_Click
End If
Set MyDb = CurrentDb
Set rs = MyDb.OpenRecordset("Select * from Users", dbOpenSnapshot)
If Not rs.EOF Then
Me.txtTypeid.SetFocus
Me.txtTypeid = rs("Typeid").Value
Me.txtUsername = rs("Username").Value
Me.txtPassword = rs("Password").Value
rs.FindFirst ("Typeid")
If Me.txtTypeid.Value <= 1 Then
DoCmd.OpenForm "AdminMenu"
Call Clear_Click
Exit Sub
End If
If Me.txtTypeid.Value <= 2 Then
DoCmd.OpenForm "EmpMenu"
Call Clear_Click
Else
MsgBox "No permision"
End If
End If
I have a table in my access project called users that contains UserID,
username, and TypeID. I create an unbound form with three test field
(txtUsername, txtPassward and txtTypeid) and two control OK and Cancel
I have two different menu callde AdminMenu and EmpMenu. What I want to
accomplish is when a user enter he or her username, password and typid the
system will read a query called users and determines which form to open.
Please, take a look at the code displayed below. The code only open the
adminmenu. please help me.
----------------------------------------------------------------
Dim MyDb As DAO.Database
Dim rs As DAO.Recordset
Dim Title As String
Title = "Makai-IT"
Dim txtUsername As String
Dim txtPassword As String
Dim txtTypeid As integer
If Me.txtPassword = "" And Me.txtUsername = "" Then
MsgBox "That can not comput"
Exit Sub
Call Clear_Click
End If
Set MyDb = CurrentDb
Set rs = MyDb.OpenRecordset("Select * from Users", dbOpenSnapshot)
If Not rs.EOF Then
Me.txtTypeid.SetFocus
Me.txtTypeid = rs("Typeid").Value
Me.txtUsername = rs("Username").Value
Me.txtPassword = rs("Password").Value
rs.FindFirst ("Typeid")
If Me.txtTypeid.Value <= 1 Then
DoCmd.OpenForm "AdminMenu"
Call Clear_Click
Exit Sub
End If
If Me.txtTypeid.Value <= 2 Then
DoCmd.OpenForm "EmpMenu"
Call Clear_Click
Else
MsgBox "No permision"
End If
End If