Charlotte Foust
cfoust at infostatsystems.com
Fri Sep 3 15:00:00 CDT 2004
Yes. You need to create either functions or macros for custom actions in the menubars. Charlotte -----Original Message----- From: Nicholson, Karen [mailto:cyx5 at cdc.gov] Sent: Friday, September 03, 2004 12:16 PM To: accessd at databaseadvisors.com Subject: [AccessD] VB Menus - Creating Function for Actions? I am coding my custom menus for many forms. From what I have read, it seems that in order to process an .OnAction, one needs to create a function that can be reference inside of, for instance: .Caption = "Tracking Sheet - Approval Applications" .OnAction = "fnOpenTrackingSystemCL" Do I really need to create functions to execute something as simple as: DoCmd.OpenForm "frmTrackingSystemCL", acNormal DoCmd.Maximize (which is in the function fnOpenTrackingSystemCL) Show below is my code for the menu item; there are a few modules associated with this code to make it work, but this is the bulk of it: Sub CreateNewMenuB() Dim strMenuNameB As String Dim cmdNewMenuB As CommandBar Dim cctlFormMenuB As CommandBarControl Dim cctlExitMenuB As CommandBarControl strMenuNameB = "ClosedProjectsMenu" 'If strMenuName exists then deleted it. Commandbars have unique names. 'See global section for fIsCreated If fIsCreated(strMenuNameB) Then Application.CommandBars(strMenuNameB).Delete End If 'Create a new Commandbar as MenuType Set cmdNewMenuB = Application.CommandBars.Add(strMenuNameB, msoBarTop, True, False) With cmdNewMenuB 'Set commandbar protection to no protection so users can change it .Protection = msoBarNoProtection 'Show new menu .Visible = True End With 'Creating Form menu Set cctlFormMenuB = cmdNewMenuB.Controls.Add(msoControlPopup) cctlFormMenuB.Caption = "&File" 'Creating Exit menu under File Set cctlExitMenuB = cctlFormMenuB.Controls.Add(msoControlButton) With cctlExitMenuB .Caption = "R&eturn" .OnAction = "fnQuitApp" .Caption = "Tracking Sheet - Approval Applications" .OnAction = "fnOpenTrackingSystemCL" End With End Sub Karen Nicholson National Laboratory Xerox Global Services -- _______________________________________________ AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com