Hi,
I am aware on how to retrieve the commandbars collection from the current db (see example), but does anyone know how to do this from a remote Access db? I tried a few variations, namely using a DAO.Database and dbEngine.workspaces, but it doesn't seem to recognize this collection. I tried also w/ the Forms collection, it didn't work, so obviously this isn't my solution. Please help
Example - (I need to edit this so I retrieve the commandbar collection from a remote database)
Function ListCommandBarObjects()
Dim cb As CommandBars
For Each cb In CommandBars
With Me.List1
.AddItem cb.Name
End With
Next
End Function
Direct quote from Access Help
Microsoft Access is a COM component that supports Automation, formerly called OLE Automation. You can manipulate Microsoft Access objects from another application that also supports Automation. To do this, you use the Application object.
For example, Microsoft Visual Basic is a COM component. You can open a Microsoft Access database from Visual Basic and work with its objects. From Visual Basic, first create a reference to the Microsoft Office Access 2003 object library. Then create a new instance of the Application class and point an object variable to it, as in the following example:
Dim appAccess As New Access.Application
From applications that don't support the New keyword, you can create a new instance of the Application class by using the CreateObject function:
Dim appAccess As Object
Set appAccess = CreateObject("Access.Application")
Once you've created a new instance of the Application class, you can open a database or create a new database, by using either the OpenCurrentDatabase method or the NewCurrentDatabase method. You can then set the properties of the Application object and call its methods. When you return a reference to the
CommandBars object by using the
CommandBars property of the Application object,
you can access all Office 2003 command bar objects and collections by using this reference.
You can also manipulate other Microsoft Access objects through the Application object. For example, by using the OpenForm method of the Microsoft Access DoCmd object, you can open a Microsoft Access form from Microsoft Excel:
appAccess.DoCmd.OpenForm "Orders"
Hope this helps