|
这是我向网上高手学习权限时下载的模块代码,因本人只是读懂少部份内容,请高手帮我解析一下!
Function SetMainSwitchBoard()
Select Case UserType()
Case "Other"
MsgBox "You don't have access to payroll system!"
DoCmd.Quit
Case "HR_Operator"
Application.SetOption "Built-In ToolBars Available", False
Application.SetOption "Can Customize Toolbars", False
DoCmd.ShowToolbar "MyToolBar", A_TOOLBAR_YES
Application.SetOption "Key Assignment Macro", "MyKeyHandle"
Application.MenuBar = "MyMenuBar"
DoCmd.OpenForm "MainSwitchBoard_HR"
Case "ayroll_Operator"
Application.SetOption "Built-In ToolBars Available", False
Application.SetOption "Can Customize Toolbars", False
DoCmd.ShowToolbar "MyToolBar", A_TOOLBAR_YES
Application.SetOption "Key Assignment Macro", "MyKeyHandle"
Application.MenuBar = "MyMenuBar"
DoCmd.OpenForm "MainSwitchBoard_Payroll"
Case "Operator"
Application.SetOption "Built-In ToolBars Available", False
Application.SetOption "Can Customize Toolbars", False
DoCmd.ShowToolbar "MyToolBar", A_TOOLBAR_YES
Application.SetOption "Key Assignment Macro", "MyKeyHandle"
Application.MenuBar = "MyMenuBar"
DoCmd.OpenForm "MainSwitchBoard_admin"
Case "Admin"
Application.SetOption "Built-In ToolBars Available", True
DoCmd.ShowToolbar "MyToolBar", A_TOOLBAR_YES
Application.SetOption "Key Assignment Macro", "AutoKeys"
Application.SetOption "Can Customize Toolbars", True
DoCmd.OpenForm "MainSwitchBoard_Admin"
Case "Vacation"
Application.SetOption "Built-In ToolBars Available", False
Application.SetOption "Can Customize Toolbars", False
DoCmd.ShowToolbar "MyToolBar", A_TOOLBAR_YES
Application.SetOption "Key Assignment Macro", "MyKeyHandle"
Application.MenuBar = "MyMenuBar"
DoCmd.OpenForm "MainSwitchBoard_Vacation"
Case "Finance_Operator", "Finance_Inquiry"
Application.SetOption "Built-In ToolBars Available", False
Application.SetOption "Can Customize Toolbars", False
DoCmd.ShowToolbar "MyToolBar", A_TOOLBAR_YES
Application.SetOption "Key Assignment Macro", "MyKeyHandle"
Application.MenuBar = "MyMenuBar"
DoCmd.OpenForm "MainSwitchBoard_Journal"
Case "Finance_Admin"
Application.SetOption "Built-In ToolBars Available", False
Application.SetOption "Can Customize Toolbars", False
DoCmd.ShowToolbar "MyToolBar", A_TOOLBAR_YES
Application.SetOption "Key Assignment Macro", "MyKeyHandle"
Application.MenuBar = "MyMenuBar"
DoCmd.OpenForm "MainSwitchBoard_Finance"
Case "HR_Inquiry"
Application.SetOption "Built-In ToolBars Available", False
Application.SetOption "Can Customize Toolbars", False
DoCmd.ShowToolbar "MyToolBar", A_TOOLBAR_YES
Application.SetOption "Key Assignment Macro", "MyKeyHandle"
Application.MenuBar = "MyMenuBar"
DoCmd.OpenForm "MainSwitchBoard_HR_Inquiry"
Case "ayroll_Inquiry"
Application.SetOption "Built-In ToolBars Available", False
Application.SetOption "Can Customize Toolbars", False
DoCmd.ShowToolbar "MyToolBar", A_TOOLBAR_YES
Application.SetOption "Key Assignment Macro", "MyKeyHandle"
Application.MenuBar = "MyMenuBar"
DoCmd.OpenForm "MainSwitchBoard_Payroll_Inquiry"
Case Else
MsgBox "You don't have access to payroll system!"
DoCmd.Quit
End Select
End Function
Function UserType()
On Error GoTo Err_userType
Dim usrCurUser As User
Dim oneGroup As Group
Dim blnAdmin, blnInquiry, blnOperator, blnHR, blnPayroll, blnFinance, blnVacation, blnFinanceAdmin As Boolean
Dim strResult As String
'Set usrCurUser = CurrentUser()
|
|