User đăng nh
ập bằng tài khoản của mình vào chương trình, tại form nhập thông tin học viên chỉ có thể nhìn và chọn các lớp do mình quản lý (theo phân công trong bảng DMLOPHOC) thì có cách nào không ah?Đây là file và code phân quyền
Option Compare Database
Option Explicit
Private Sub cmdLogin_Click()
If IsNull(Me.txtuser) Or Me.txtuser = "" Then
MsgBox "Khong co nhan vat dang nhap cu the, de nghi nhap user!", vbCritical
Me.txtuser.SetFocus
Else
Select Case Me.txtpass
Case Me.txtuser.Column(1)
MsgBox "DANG NHAP THANH CONG"
Me.Visible = True
DoCmd.Close
Case Is <> Me.txtuser.Column(1)
MsgBox "Mat khau hoac ten dang nhap khong dung"
Case Else
MsgBox "ban khong co quyen truy cap"
End Select
End If
End Sub
Private Sub txtuser_AfterUpdate()
Quyen.Value = DLookup("[Quyen]", "tadmin", "[user] = txtuser.Value")
CommandBars("thucdon").Controls(1).Visible = True
CommandBars("thucdon").Controls(2).Visible = True
CommandBars("thucdon").Controls(3).Visible = True
CommandBars("thucdon").Controls(4).Visible = True
Select Case Quyen.Value
Case 0
CommandBars("thucdon").Controls(1).Controls(1).Visible = True
CommandBars("thucdon").Controls(1).Controls(2).Visible = True
CommandBars("thucdon").Controls(1).Controls(3).Controls(1).Visible = True
CommandBars("thucdon").Controls(1).Controls(3).Controls(2).Visible = True
CommandBars("thucdon").Controls(1).Controls(3).Controls(3).Visible = False
CommandBars("thucdon").Controls(1).Controls(3).Controls(4).Visible = False
CommandBars("thucdon").Controls(2).Controls(1).Controls(1).Visible = True
CommandBars("thucdon").Controls(2).Controls(1).Controls(2).Visible = True
CommandBars("thucdon").Controls(2).Controls(2).Controls(1).Visible = True
CommandBars("thucdon").Controls(2).Controls(2).Controls(2).Visible = True
CommandBars("thucdon").Controls(2).Controls(2).Controls(3).Visible = True
CommandBars("thucdon").Controls(2).Controls(3).Controls(1).Visible = True
CommandBars("thucdon").Controls(2).Controls(3).Controls(2).Visible = True
CommandBars("thucdon").Controls(2).Controls(3).Controls(3).Visible = True
CommandBars("thucdon").Controls(3).Controls(1).Controls(1).Visible = True
CommandBars("thucdon").Controls(3).Controls(1).Controls(2).Visible = True
CommandBars("thucdon").Controls(3).Controls(1).Controls(3).Visible = True
CommandBars("thucdon").Controls(3).Controls(1).Controls(4).Visible = True
CommandBars("thucdon").Controls(3).Controls(1).Controls(5).Visible = True
CommandBars("thucdon").Controls(3).Controls(1).Controls(6).Visible = True
CommandBars("thucdon").Controls(3).Visible = True
CommandBars("thucdon").Controls(4).Visible = True
Case 1
CommandBars("thucdon").Controls(1).Controls(1).Visible = False
CommandBars("thucdon").Controls(1).Controls(2).Visible = True
CommandBars("thucdon").Controls(1).Controls(3).Controls(1).Visible = True
CommandBars("thucdon").Controls(1).Controls(3).Controls(2).Visible = True
CommandBars("thucdon").Controls(1).Controls(3).Controls(3).Visible = True
CommandBars("thucdon").Controls(1).Controls(3).Controls(4).Visible = True
CommandBars("thucdon").Controls(2).Visible = True
CommandBars("thucdon").Controls(3).Visible = True
CommandBars("thucdon").Controls(4).Visible = True
CommandBars("thucdon").Controls(4).Visible = False
Case 2
CommandBars("thucdon").Controls(1).Controls(1).Visible = False
CommandBars("thucdon").Controls(1).Controls(2).Controls(1).Visible = True
CommandBars("thucdon").Controls(1).Controls(2).Controls(2).Visible = True
CommandBars("thucdon").Controls(1).Controls(3).Controls(1).Visible = True
CommandBars("thucdon").Controls(1).Controls(3).Controls(2).Visible = True
CommandBars("thucdon").Controls(1).Controls(3).Controls(3).Visible = True
CommandBars("thucdon").Controls(1).Controls(3).Controls(4).Visible = False
CommandBars("thucdon").Controls(2).Controls(1).Controls(1).Visible = False
CommandBars("thucdon").Controls(2).Controls(2).Visible = True
CommandBars("thucdon").Controls(2).Controls(3).Visible = True
CommandBars("thucdon").Controls(3).Visible = True
CommandBars("thucdon").Controls(4).Visible = True
CommandBars("thucdon").Controls(4).Visible = False
Case 3
CommandBars("thucdon").Controls(1).Controls(1).Visible = False
CommandBars("thucdon").Controls(1).Controls(2).Visible = False
CommandBars("thucdon").Controls(1).Controls(3).Controls(1).Visible = False
CommandBars("thucdon").Controls(1).Controls(3).Controls(2).Visible = False
CommandBars("thucdon").Controls(1).Controls(3).Controls(3).Visible = False
CommandBars("thucdon").Controls(1).Controls(3).Controls(4).Visible = True
CommandBars("thucdon").Controls(2).Controls(1).Controls(1).Visible = False
CommandBars("thucdon").Controls(2).Controls(1).Controls(2).Visible = False
CommandBars("thucdon").Controls(2).Controls(2).Controls(1).Visible = False
CommandBars("thucdon").Controls(2).Controls(2).Controls(2).Visible = False
CommandBars("thucdon").Controls(2).Controls(2).Controls(3).Visible = False
CommandBars("thucdon").Controls(2).Controls(3).Controls(1).Visible = False
CommandBars("thucdon").Controls(2).Controls(3).Controls(2).Visible = False
CommandBars("thucdon").Controls(2).Controls(3).Controls(3).Visible = False
CommandBars("thucdon").Controls(3).Controls(1).Controls(1).Visible = False
CommandBars("thucdon").Controls(3).Controls(1).Controls(2).Visible = False
CommandBars("thucdon").Controls(3).Controls(1).Controls(3).Visible = False
CommandBars("thucdon").Controls(3).Controls(1).Controls(4).Visible = False
CommandBars("thucdon").Controls(3).Controls(1).Controls(5).Visible = True
CommandBars("thucdon").Controls(3).Controls(1).Controls(6).Visible = False
CommandBars("thucdon").Controls(3).Visible = True
CommandBars("thucdon").Controls(4).Visible = False
Case 4
CommandBars("thucdon").Controls(1).Controls(1).Visible = True
CommandBars("thucdon").Controls(1).Controls(2).Visible = False
CommandBars("thucdon").Controls(1).Controls(3).Controls(1).Visible = False
CommandBars("thucdon").Controls(1).Controls(3).Controls(2).Visible = False
CommandBars("thucdon").Controls(1).Controls(3).Controls(3).Visible = False
CommandBars("thucdon").Controls(1).Controls(3).Controls(4).Visible = False
CommandBars("thucdon").Controls(2).Controls(1).Controls(1).Visible = False
CommandBars("thucdon").Controls(2).Controls(1).Controls(2).Visible = False
CommandBars("thucdon").Controls(2).Controls(2).Controls(1).Visible = False
CommandBars("thucdon").Controls(2).Controls(2).Controls(2).Visible = False
CommandBars("thucdon").Controls(2).Controls(2).Controls(3).Visible = False
CommandBars("thucdon").Controls(2).Controls(3).Controls(1).Visible = False
CommandBars("thucdon").Controls(2).Controls(3).Controls(2).Visible = False
CommandBars("thucdon").Controls(2).Controls(3).Controls(3).Visible = False
CommandBars("thucdon").Controls(3).Controls(1).Controls(1).Visible = False
CommandBars("thucdon").Controls(3).Controls(1).Controls(2).Visible = False
CommandBars("thucdon").Controls(3).Controls(1).Controls(3).Visible = False
CommandBars("thucdon").Controls(3).Controls(1).Controls(4).Visible = False
CommandBars("thucdon").Controls(3).Controls(1).Controls(5).Visible = False
CommandBars("thucdon").Controls(3).Controls(1).Controls(6).Visible = False
CommandBars("thucdon").Controls(3).Visible = False
CommandBars("thucdon").Controls(4).Visible = False
Case 5
CommandBars("thucdon").Controls(1).Controls(1).Visible = False
CommandBars("thucdon").Controls(1).Controls(2).Controls(1).Visible = True
CommandBars("thucdon").Controls(1).Controls(2).Controls(2).Visible = True
CommandBars("thucdon").Controls(1).Controls(3).Controls(1).Visible = True
CommandBars("thucdon").Controls(1).Controls(3).Controls(2).Visible = True
CommandBars("thucdon").Controls(1).Controls(3).Controls(3).Visible = True
CommandBars("thucdon").Controls(1).Controls(3).Controls(4).Visible = False
CommandBars("thucdon").Controls(2).Controls(1).Controls(1).Visible = False
CommandBars("thucdon").Controls(2).Controls(2).Visible = True
CommandBars("thucdon").Controls(2).Controls(3).Visible = True
CommandBars("thucdon").Controls(3).Visible = True
CommandBars("thucdon").Controls(4).Visible = True
CommandBars("thucdon").Controls(4).Visible = False
Case 6
CommandBars("thucdon").Controls(1).Controls(1).Visible = False
CommandBars("thucdon").Controls(1).Controls(2).Controls(1).Visible = True
CommandBars("thucdon").Controls(1).Controls(2).Controls(2).Visible = True
CommandBars("thucdon").Controls(1).Controls(3).Controls(1).Visible = True
CommandBars("thucdon").Controls(1).Controls(3).Controls(2).Visible = True
CommandBars("thucdon").Controls(1).Controls(3).Controls(3).Visible = True
CommandBars("thucdon").Controls(1).Controls(3).Controls(4).Visible = False
CommandBars("thucdon").Controls(2).Controls(1).Controls(1).Visible = False
CommandBars("thucdon").Controls(2).Controls(2).Visible = True
CommandBars("thucdon").Controls(2).Controls(3).Visible = True
CommandBars("thucdon").Controls(3).Visible = True
CommandBars("thucdon").Controls(4).Visible = True
CommandBars("thucdon").Controls(4).Visible = False
Case 7
CommandBars("thucdon").Controls(1).Controls(1).Visible = False
CommandBars("thucdon").Controls(1).Controls(2).Controls(1).Visible = True
CommandBars("thucdon").Controls(1).Controls(2).Controls(2).Visible = True
CommandBars("thucdon").Controls(1).Controls(3).Controls(1).Visible = True
CommandBars("thucdon").Controls(1).Controls(3).Controls(2).Visible = True
CommandBars("thucdon").Controls(1).Controls(3).Controls(3).Visible = True
CommandBars("thucdon").Controls(1).Controls(3).Controls(4).Visible = False
CommandBars("thucdon").Controls(2).Controls(1).Controls(1).Visible = False
CommandBars("thucdon").Controls(2).Controls(2).Visible = True
CommandBars("thucdon").Controls(2).Controls(3).Visible = True
CommandBars("thucdon").Controls(3).Visible = True
CommandBars("thucdon").Controls(4).Visible = True
CommandBars("thucdon").Controls(4).Visible = False
End Select
End Sub
File: http://www.mediafire.com/download/yy3k1c...on+1.0.mdb
Nhờ các anh giúp đỡ vấn đề trên!Em cảm ơn