Office中国论坛/Access中国论坛

标题: 关于菜单的废止问题 [打印本页]

作者: wangjian5418    时间: 2005-5-19 02:37
标题: 关于菜单的废止问题
大家帮我看看这个阿,在操作员登录时,只有查询和退出菜单可用,其他都是灰的,系统管理员登录时所有菜单都可用[attach]10526[/attach]

作者: tmtony    时间: 2005-5-19 08:08
使用类似下面的函数:
Public Function AllowMenus(CmdBarName As String, CmdbarEnabled As _
   Boolean)

   '============================================================='
   'This function has two arguments: CmdbarName is a string that '
   'passes the name of the command bar that the code enables or  '
   'disables. CmdBarEnabled is a Boolean value in which you pass '
   '"True" or "False" in order to enable or disable the command  '
   'bar being modified.                                          '
   '                                                             '
   'Example: To disable the command bar "NorthwindCustomMenuBar" '
   'in the Northwind sample database, use the following:         '
   '                                                             '
   'AllowMenus("NorthwindCustomMenuBar",False)                   '
   '============================================================='

   Dim Cmdbar As CommandBar, Cbct As CommandBarControl

   On Error GoTo Err_AllowMenus
   Set Cmdbar = CommandBars(CmdBarName)

   If Cmdbar.Visible = False Then Cmdbar.Visible = True

      For Each Cbct In Cmdbar.Controls
         Cbct.Enabled = CmdbarEnabled
      Next Cbct

   Exit_AllowMenus:
      Exit Function

   Err_AllowMenus:
   MsgBox "Error " & CStr(Err) & " " & Err.Description & _
      " has occurred in the AllowMenus Function", vbOKOnly, _
      "Error Detected"
   Resume Exit_AllowMenus

End Function
使用方法: AllowMenus("你的工具条名", False)
以上函数摘自微软,详细原文请参照:
http://support.microsoft.com/?kbid=202308
作者: wangjian5418    时间: 2005-5-20 05:08
这个只能废止全部阿,我有时还要废止子菜单的阿
作者: wangjian5418    时间: 2005-5-20 05:25
access2003没有Commandbar属性阿




欢迎光临 Office中国论坛/Access中国论坛 (http://www.office-cn.net/) Powered by Discuz! X3.3