[AccessD] Missing references

Bryan Carbonnell carbonnb at gmail.com
Thu Feb 15 15:38:02 CST 2007


On 2/15/07, Mark A Matte <markamatte at hotmail.com> wrote:

> Since I'm not versed in Binding(Late or Early) ...I've looked at MS
> knowledge base...and most of what I found was problems and fixes.
>
> Any suggestions for 'crash course READING' in bindings?

Here's a quick description that I lifted from an article I wrote
http://www.databaseadvisors.com/newsletters/newsletter072002/0207wordautomationlpt1.asp


Early Binding Versus Late Binding

First you need to decide whether to use Early Binding or Late Binding.
Early Binding allows you to dimension variables by their specific data
type. For example, the following declarations refer to the Word
Application and Document objects rather than declaring both as generic
objects:

Dim objWord as Word.Application
Dim doc as Word.Document

Early Binding also enables a few built-in Intelli-sense features: Auto
Complete, Auto List Members, and Auto Quick Info. In addition, using
early binding allows you to view Word's object model in the Object
Browser.

The downside to Early Binding is that you have to set a reference to a
specific version of Word. Sometimes Access is smart enough to change
the reference to the specific version of Word that is installed on the
PC you are deploying your application; often it isn't, and you could
end up with problems relating to the references.

If you decide to use Late Binding, you will have to dimension all of
your variables as Objects as follows:

Dim objWord as Object
Dim doc as Object

Consequently, you cannot access any of your variables until you set
them to a specific object as shown below:

Set objWord = CreateObject("Word.Application")
Set doc = objWord.Documents.Open("C:\Path\To\file.doc")

In addition, the Intelli-sense features, Auto Complete, Auto List
Members, Auto Quick Info and disables viewing of Word's object model
in the Object Browser. However, Late Binding doesn't require that you
set a reference to any Word Object Library, which can be advantageous
if you are deploying run-time versions of your application to mixed
OS/Office Version platforms.

Instead of choosing one or the other, we suggest you compromise and
use both. During the development phase use Early Binding. Once you
release the application, remove all specific references and change
each to Object—the best of both worlds!

Now that the binding issue is resolved, let's roll up our sleeves and
dive into writing some code.



-- 
Bryan Carbonnell - carbonnb at gmail.com
Life's journey is not to arrive at the grave safely in a well
preserved body, but rather to skid in sideways, totally worn out,
shouting "What a great ride!"



More information about the AccessD mailing list