paul.hartland at fsmail.net
paul.hartland at fsmail.net
Thu Apr 27 09:41:29 CDT 2006
Jim, Thanks for email, I managed to suss out something similar but will keep the code for future reference. Thanks again. Paul Hartland Message Received: Apr 27 2006, 03:36 PM From: "Jim DeMarco" To: "Access Developers discussion and problem solving" Cc: Subject: Re: [AccessD] Calling Parameter Function From Menu Bar On Action Command Paul, Menu bar objects can take 1 parameter if that's what you need. I pulled this code from a demo of a class-based menu creation tool I wrote. Hopefully this snip is enough to get you going. Private m_cbrctlMenuItem As CommandBarControl 'module level variable Public Function AddMenuItem(WhichMenu As CommandBarControl, ItemCaption As String, _ DoOnClick As String, Optional NewGroup As Boolean = False, _ Optional Parm As String) As Boolean Set m_cbrctlMenuItem = WhichMenu.Controls.Add(Type:=msoControlButton) With m_cbrctlMenuItem .Caption = "your text here" .Style = msoButtonCaption .OnAction = DoOnClick .BeginGroup = NewGroup .Parameter = Parm End With End Function Jim DeMarco -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of paul.hartland at fsmail.net Sent: Monday, April 24, 2006 10:38 AM To: accessd Subject: [AccessD] Calling Parameter Function From Menu Bar On Action Command Importance: High To all, I am using a couple of menu bars which call functions with no problem at all, however I have a function which does everything I need for my new menu bar with the exception of a couple of additional commands at the end. I tried making the function with a parameter ( function CallMe(strType as String) ) and putting either a 1 or a 2 in the parameter options, however it wont now run the function. I would rather not copy all the code again as this seems a bit of a waste to me. So is there a way I can pass a parameter to a function from one of my menu bar options. Thanks in advance for any help on this. Paul Hartland -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com