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 / Developer Toolkits / June 2004

Tip: Looking for answers? Try searching our database.

Receiving Events from MS Access from Custom Toolbar in VB.NET

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Alain Hogue - 15 Jun 2004 06:09 GMT
Hi everyone!

I have created a toolbar to use in MS Access 2000, 2002, 2003. I would like
to be notified when the user select a new database or close the current one.
Also I would like my toolbar to remain available even if no database is
opened.

I am presently using Interop from a VB.NET AddIn build with the v1.1
Framework. I am also using the PIA Interop dll. I was not able to find any
event raised by Access that I could subscribe to.

I am starting to look at low level API to achieve this.

Please advice!

Thanks!

Signature

Alain Hogue
CNA, MCT, MCSE NT4/W2K, MCSD, MCDBA, CCNA, CCDA

Albert D. Kallal - 22 Jun 2004 20:43 GMT
> Hi everyone!
>
> I have created a toolbar to use in MS Access 2000, 2002, 2003. I would like
> to be notified when the user select a new database or close the current one.
> Also I would like my toolbar to remain available even if no database is
> opened.

I would say that you need to build code for each item in the menu bar. In
fact, when I create custom menu bars, or tools bars, I write code for each
option in the toolbar. If you write code for each option, then you certainly
then can come up with some schemes to notify your application.

however, like in c++, or vb, or most environments, there is NOT a event that
fires when you open a file in vb, or c++. and, also this is the same in
ms-access.

So, for most of the menu options, that menu code can (and in fact often
does) call standard code in a module. However, there is NOT a VBA equivalent
of the file open command exposed.

Signature

Albert D. Kallal   (Access MVP)
Edmonton, Alberta Canada
pleaseNOOSpamKallal@msn.com
http://www.attcanada.net/~kallal.msn

Alain Hogue - 23 Jun 2004 11:35 GMT
Thanks for answering my post. But this is not exactly my problem.

First I am using a custom toolbar. Access do not allow custom toolbar to
remain available if there is no database opened.
Second, some program, like Excel, raise event when someone open or close a
workbook. Why not Access?
Finaly, when the user close the database, Access just stop showing my
toolbar. I have no way of knowing if a database was closed or not.

Have a nice day!

> > Hi everyone!
> >
[quoted text clipped - 17 lines]
> does) call standard code in a module. However, there is NOT a VBA equivalent
> of the file open command exposed.
Albert D. Kallal - 23 Jun 2004 19:58 GMT
> Thanks for answering my post. But this is not exactly my problem.
>
> First I am using a custom toolbar. Access do not allow custom toolbar to
> remain available if there is no database opened.

That is correct. Each mdb represents a application. You could customize the
actual built in ones, but what code could they call?

> Second, some program, like Excel, raise event when someone open or close a
> workbook. Why not Access?

It is true, both word, and excel do have events for this. However, they are
document orientated systems, where as ms-access is a database. The is a big
difference here (however, I suppose it would be nice to have some event
exposed, but then again, where will the code reside?. If you are using
ms-access as com object, then can certainly see that controlling this event
would be nice..but then again, we are talking about database system, and not
a document orientated system like excel/word. Excel, or word always loads
the WHOLE document into memory, where as ms-access does not. So, in
ms-access, we don't load, or un-load a whole document. Ms-access only loads
PART of a file, or part of the data. So, if you have a large file with 1
million records, and open to ONE record..ONLY that one record is loaded. In
addition, ms-access is multi-user, and once again the concepts of having a
file open, or closed begins to blur a bit as compared to simple document
systems like excel/word). So, while it would be nice..there is quite a few
differences on a conceptual level here when comparing ms-access to
applications like word, excel, power-point, all which work on a SINGLE
document that is LOADED INTO memory. (ms-access does NOT follow this concept
at all, nor does it load the whole data file into memory).

> Finaly, when the user close the database, Access just stop showing my
> toolbar. I have no way of knowing if a database was closed or not.

That is correct. The work around is to load a invisable form, and use the
close/un-load events of that form

Signature

Albert D. Kallal   (Access MVP)
Edmonton, Alberta Canada
pleaseNOOSpamKallal@msn.com
http://www.attcanada.net/~kallal.msn

Alain Hogue - 24 Jun 2004 16:02 GMT
Thanks again for sharing all this with me. It dows help (kind of)

The problem I am facing is I am building a generic toolbar to be used in ALL
databases, old and new. This toolbar is build in VB.NET and could be used by
anyone in Access. It provide a interface users can use to connect to
download informations in their current database. There is NO code or form
created in the database at all. The only things I do is create a new table
to store the result of the query (retrieved from within VB.NET from an
external Business Controler using remoting to access data stored in a remote
SQL server)

Now, if I create a button on the Database Toolbar, this button remain
available even if there is no database opened. Access itself have numerous
toolbar available at all time, even if no databases are opened. How can I
hack Access and force my toolbar to be available even if there is no
databases opened?

Thanks!

> > Thanks for answering my post. But this is not exactly my problem.
> >
[quoted text clipped - 31 lines]
> That is correct. The work around is to load a invisable form, and use the
> close/un-load events of that form
Albert D. Kallal - 25 Jun 2004 05:56 GMT
> Now, if I create a button on the Database Toolbar, this button remain
> available even if there is no database opened. Access itself have numerous
> toolbar available at all time, even if no databases are opened. How can I
> hack Access and force my toolbar to be available even if there is no
> databases opened?

You certainly could modify one of the built in menu bars. I mean, there is a
menu bar called Utility 1, and Utility 2.

You could check to see if any "existing" customizing of these "extra" menus
has been done, if yes:

   pull out the changes
   delete all the buttions
   Put in your buttions
   Show the menu.

When you shut down the application, you would have to reverse the above....

In fact, it is VERY rare that people customize utility 1, or utility 2.
(they usually blank). So, you could consider just adding your buttons to the
tool bar. Furhter, when you add your buttions...you can have them NOT be
saved....

Signature

Albert D. Kallal   (Access MVP)
Edmonton, Alberta Canada
pleaseNOOSpamKallal@msn.com
http://www.attcanada.net/~kallal.msn

Alain Hogue - 29 Jun 2004 06:51 GMT
Thanks for the info. I did not known the existance of Utility1 and 2. I
suppose I could try using that instead.

You have been very helpfull. Thanks!

> > Now, if I create a button on the Database Toolbar, this button remain
> > available even if there is no database opened. Access itself have numerous
[quoted text clipped - 19 lines]
> tool bar. Furhter, when you add your buttions...you can have them NOT be
> saved....
david epsom dot com dot au - 23 Jun 2004 23:57 GMT
> First I am using a custom toolbar. Access do not allow custom toolbar
> remain available if there is no database opened.

The people who originally developed Access had in mind a 'relational'
database system, where all the data ABOUT the data in the database
was also stored in the database.  That included the menu system,
stored procedures, views, and the keyboard mapping.

(user preferences were stored in a separate user preference database)

Access has since been hacked around to share code with Office and
VBA, but in the main, Office and VBA have not been changed to match
Access, so implementation differences remain.

(david)

> Thanks for answering my post. But this is not exactly my problem.
>
[quoted text clipped - 31 lines]
> equivalent
> > of the file open command exposed.
 
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.