Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / General 2 / June 2007

Tip: Looking for answers? Try searching our database.

set menubar and toolbar for all reports via code

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
microb0x - 19 Jun 2007 17:31 GMT
Does anyone know how to enumerate through the AllReports collection to
set a custom menubar and toolbar for each report in the collection?

I can set the menubar and toolbar when a report is open, but I need to
be able to set these whether a report is open or not.

I need to set the menu/tool bars for each report during the launch of
the startup form.  There are 60 some reports in the application, and
ever growing, and I'd rather not have to set each one individually via
its property sheet
Brendan Reynolds - 20 Jun 2007 09:42 GMT
> Does anyone know how to enumerate through the AllReports collection to
> set a custom menubar and toolbar for each report in the collection?
[quoted text clipped - 6 lines]
> ever growing, and I'd rather not have to set each one individually via
> its property sheet

You need to open the reports in design view, but you don't have to do it
manually, you can automate it ...

Public Sub SetRepProp()

   Dim aob As AccessObject
   Dim rpt As Report

   For Each aob In CurrentProject.AllReports
       DoCmd.OpenReport aob.Name, acViewDesign, , , acHidden
       Set rpt = Reports(aob.Name)
       rpt.MenuBar = "MyMenuBar"
       rpt.ShortcutMenuBar = "MyShortCutMenuBar"
       rpt.Toolbar = "MyToolbar"
       DoCmd.Close acReport, aob.Name, acSaveYes
   Next aob

   Debug.Print "Finished!"

End Sub

Signature

Brendan Reynolds

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.