B.3. Building Code Libraries

In addition to the four types of reference libraries (OLB, TLB, DLL, and OCX), a set of library types is often overlooked. These types include:

  • MS Access databases: ACCDB, ACCDE, MDB and MDE

  • MS Access add-ins: ACCDA and MDA

  • MS Access projects: ADP and ADE

With these types of references, you can develop your own code libraries that contain routines to share in all of your applications. An example might be something like a common error handling routine.

Because you can use these routines over and over, you can justify putting a little more effort into them. Take error handling, for example. Generally, you develop code to display a message to the user requesting that the user report the error to you. Have you ever seen a user use your application and expose an error you hadn't found in testing? He clicks OK on the message without giving it a second thought. You ask why he didn't wait to review the message, and he says, "Oh, that happens all the time. I was told to just ignore it."

Suppose that instead of depending on the users to call in report errors, you write routines to track the errors in a table. Then you could investigate what is happening. Perhaps your tables could even maintain some trace data to help discover what causes the problem. Suppose you also realize that the main reason errors don't get reported is that it is too difficult for the user to report them. So you add some functionality that builds an e-mail message for the user to send through ...

Get Access™ 2007 VBA Programmer's Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.