473,322 Members | 1,699 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Commandbar Collection

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
Jan 4 '08 #1
1 5341
jaxjagfan
254 Expert 100+
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
Jan 4 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Eric | last post by:
I have the following function which creates buttons on Excel commandbar. The problem i can't get the buttons to hook up to events. For example, if i create four buttons only the fourth one fires...
8
by: Generic Usenet Account | last post by:
To settle the dispute regarding what happens when an "erase" method is invoked on an STL container (i.e. whether the element is merely removed from the container or whether it also gets deleted in...
5
by: Kurt Bauer | last post by:
I have an ASP group calendar application which pulls calendar data from Exchange via webdav into an XML string. I then loop the XML nodes to populate a collection of appointments. Finally I use...
18
by: Scott | last post by:
I have a collection where the items in the collection are dates. I want to iterate over the collection and build a value list string for the rowsource of a listbox. The dates in the collection are...
3
by: adrian.chandler | last post by:
I have a form with a subform. The subform occupies about the bottom two thirds of the screen. The form has a custom CommandBar docked at the top. The subform also has its own CommandBar. I want...
2
by: Samuel | last post by:
Hi I want to customize our IDE. I developed some Add-ins and would like to create command bar to access them directly. I'm not sure if the term of "command bar" is appropriat. I mean with it a...
11
by: Pavils Jurjans | last post by:
Hello, There's some confusion about the purpose and difference between these handy classes... First, both of them are holding number of key - value pairs, right? Then, I see that there may be...
2
by: Brian | last post by:
NOTE ALSO POSTED IN microsoft.public.dotnet.framework.aspnet.buildingcontrols I have solved most of my Server Control Collection property issues. I wrote an HTML page that describes all of the...
0
by: anonymous | last post by:
Hello, I have a small problem with a VBA commandbar I'm using in Word 2003. I created the toolbar -which works fine - and added some controls like : TBar.Controls.Add(Type:=msoControlEdit) ...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.