VBA Access Object Library

If you are going to automate Access from another office application using VBA there are 2 options.

  1. Early binding
  2. Late binding

In the first method we add reference to the Microsoft Access Object Library, before execution. It will run faster and we will have access to the VBA editor intellisense. On the other hand there is always the risk of compatibility issues arising when the program is run on a computer with a different version of the library installed. For more information about early vs late binding please see the link below:


Early Binding:

In this method you must add reference to the Microsoft  Access Object Library.

Step 1:
Reference
Step 2:
Locate the Microsoft Access Object Library and select it:
Reference

Note: The version installed on my computer might be different than the version installed on the computer you are using. This shouldn’t cause a problem.

Defining a Access.Application object and initiating it can be done using the code below:

Dim objAccess As Access.Application
set objAccess = new Access.Application


Method 2, Late Binding:

In this method we don’t need to add a reference to the object library. The Access.Application object is declared as a general object and initiated as shown below:

Dim objAccess As Object
Set objAccess = CreateObject("Access.Application")

See also:

If you need assistance with your code, or you are looking for a VBA programmer to hire feel free to contact me. Also please visit my website  www.software-solutions-online.com

Leave a Reply

Your email address will not be published. Required fields are marked *