Thursday, June 14, 2012

ActiveX Controls to Enhance MS Access Functionality

ActiveX is a Microsoft technology that offers components to insert into programs or web pages, similar to JAVA applets.  Here's Microsoft's description of ActiveX Controls (http://support.microsoft.com/kb/154544): 

ActiveX controls, formerly known as OLE controls or OCX controls, are components (or objects) that you can insert into a Web page or other program so that you can reuse packaged functionality that someone else programmed. For example, the ActiveX controls that are included with Internet Explorer enable you to enhance your Web pages with sophisticated formatting features and animation. 

ActiveX is an open integration platform that provides developers, users, and Web producers a fast and easy way to create integrated programs and content for the Internet and Intranets. Using ActiveX, you can easily insert multimedia effects, interactive objects, and sophisticated programs into a Web page, creating a user experience comparable to that of high quality multimedia CD-ROM titles.

In other words, ActiveX controls are mini-programs that can be inserted into, say an MS Access form, to add functionality.  File extensions of controls are dll (direct link library) or OCX (object linking and embedding).  There are many pre-designed ActiveX controls available for free or little cost.  Here are a few examples:

Adobe PDF Viewer Control
This control allows you to embed and control the view of PDF's directly in your form. 

Barcode Control
This type of ActiveX control can be inserted into a report or form and bound to data field(s).

File Download Controls
You can download files directly from the internet to the hard drive, with a progress notification with this type of control.

Document Management Controls
Microsoft Office Document Imaging 2003 (MODI) adds programmability features to the document scanning and viewing tools.  This is a great tool but no longer included with MS Access 2010 (http://support.microsoft.com/kb/982760).

Before using a custom control, it must be registered in your install of MS Access.  To do this, open the visual basic editor (Ctrl-G), select "Tools," "References" and "Browse" to your dll or ocx file, and select it.  If  you have registered the control correctly, in a form or report design mode, select "Design" and "ActiveX Controls" you will see and be able add the control. 

ActiveX Controls can be controlled by modifying the controls "Properties," or writing event handlers in VBA depending on the control.  

One example of how I have used a custom control is in a data entry application to view embedded PDF's.  I added hot-key enabled command buttons on my form that have onclick event procedures to zoom or page through the PDF.  I thus give the keyer the ability to quickly, (without using the mouse) control the navigation and viewability of the PDF and thus speed up data entry.  Of course we could open the PDF in a separate viewer but we would then have to use the mouse to control the zooming and paging.  When you have repetitive data entry, this little option saves time and ultimately, money. 

If you have the need to add functionality to your application, an internet search will expose many available controls.