Darryl Collins
Darryl.Collins at coles.com.au
Thu Sep 11 19:39:06 CDT 2008
Ok Folks That works great. Now I have a new (but related issue). How do i control the docking position on built in/ existing toolbars? In Excel VBA the code is gxltbMyToolbar.Position = 1 The control options being Top 1 Right 2 Left 0 Bottom 3 Floating 4 It seems that 4 (floating is the default) in Access, but what is the darn syntax to get them to dock? I can do this if i create the command bar from scratch, but in this case I am just using commandbars I custom built using the default button set. Set myBar = CommandBars.Add(Name:="Customer", _ Position:=msoBarTop, _ Temporary:=True) but I cannot figure out how to make existing toolbars behave! Thanks once again Darryl. -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com]On Behalf Of Stuart McLachlan Sent: Thursday, 11 September 2008 4:07 PM To: Access Developers discussion and problem solving Subject: Re: [AccessD] Controlling Custom Toolbars If you ONLY want the custom toolbar (ie you don't want the default Form toolbar as well), just set the Toolbar property in the Forms Property Sheet-Other tab. Otherwise use DoCmd.ShowToolbar "IT PMO Financial Control Tool", acToolbarYes and DoCmd.ShowToolbar "IT PMO Financial Control Tool", acToolbarNo to display/hide it. On 11 Sep 2008 at 15:48, Darryl Collins wrote: > Hi Folks, > > When I code in Excel I use custom toolbars a lot and they are dead > easy to control. Often each set will have it own toolbar that has > tools specific to its purpose and these are turned off and off using > worksheet activate/deactive. > > In this Access beastie I am building I have made up a nice little > custom toolbar, but I only want it to be available on when certain > forms are active. Struggling to get the syntax right on making the > toolbar appear / disappear. > > Here is what I have go so far (which works - it is just too darn untidy - there has to be a better way). > > '========WHAT I HAVE (which works) ======================= > Sub RemoveDataEditToolbar() > > Dim mtb As Variant ' <-- Don't like using variant, but it is the only thing I can find that works. > Dim strToolbar As String > > strToolbar = "IT PMO Financial Control Tool" > > For Each mtb In CommandBars ' <-- Don't like having to loop. Just want to set this to true or false > If mtb.Name = strToolbar Then > mtb.Visible = False > MsgBox mtb.Name & " Hidden" > End If > Next mtb > End Sub > '=============================================== > > '========WHAT I WANT (which doesn't) =================== > Sub RemoveDataEditToolbar() > > Dim mtb As Access.CommandBar > Dim strToolbar As String > > strToolbar = "IT PMO Financial Control Tool" > Set mtb = Access.CommandBar.Name(strToolbar) > mtb.Visible = False > > set mtb = nothing > End Sub > '=============================================== > > > Any ideas? > > cheers > Darryl > > This email and any attachments may contain privileged and confidential information > and are intended for the named addressee only. If you have received this e-mail in > error, please notify the sender and delete this e-mail immediately. Any > confidentiality, privilege or copyright is not waived or lost because this e-mail > has been sent to you in error. It is your responsibility to check this e-mail and > any attachments for viruses. No warranty is made that this material is free from > computer virus or any other defect or error. Any loss/damage incurred by using this > material is not the sender's responsibility. The sender's entire liability will be > limited to resupplying the material. > > > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com -- Stuart Mclachlan -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com This email and any attachments may contain privileged and confidential information and are intended for the named addressee only. If you have received this e-mail in error, please notify the sender and delete this e-mail immediately. Any confidentiality, privilege or copyright is not waived or lost because this e-mail has been sent to you in error. It is your responsibility to check this e-mail and any attachments for viruses. No warranty is made that this material is free from computer virus or any other defect or error. Any loss/damage incurred by using this material is not the sender's responsibility. The sender's entire liability will be limited to resupplying the material.