Microsoft KB Archive/190735

= ACC97: Cannot Use Early Binding with Graph 8.0 Using Automation =

Article ID: 190735

Article Last Modified on 1/23/2007

-

APPLIES TO


 * Microsoft Access 97 Standard Edition

-



This article was previously published under Q190735



Advanced: Requires expert coding, interoperability, and multiuser skills.



SYMPTOMS
In Microsoft Access, you can use Automation to connect to the Microsoft Graph object model. However Microsoft Graph does not support early binding. Therefore, when you use Automation to connect to Microsoft Graph, you must use late binding.



MORE INFORMATION
An easy way to see the difference between early and late binding is to look at the way objects are declared in code. Code that implements late binding uses the "As Object" clause when dimensioning the variable, and sets the object using the CreateObject function during run time. Code that implements early binding declares the object at the start of the code by using the Dim statement.

Example of Late Binding
Late binding means the object is created when you run the code. The object is then set after the object is declared. For example, to connect to Microsoft Excel by using late binding, you can implement the following lines of code:

' Declare an object variable to hold the object ' reference. "Dim as Object" causes late binding.

Dim ExcelSheet As Object Set ExcelSheet = CreateObject("Excel.Sheet")

Example of Early Binding
Early binding means you declare the object and name the object class type within the same line of code. There is no "As Object" clause in the Declaration section. For example, to connect to a Microsoft Excel worksheet by using early binding, you can implement the following code fragments:

Dim xlApp As Excel.Application

Dim xlBook As Excel.Workbook

Dim xlSheet As Excel.WorkSheet

Set xlApp = CreateObject("Excel.Application")

Example of Late Binding with Microsoft Graph
Because Microsoft Graph 8.0 does not support early binding, the only way to connect to the Microsoft Graph object model is by using late binding, as shown in the following example:

Dim GraphObj As Object Set GraphObj = Forms!MyForm!MyGraph.Object

For more information about late binding, please see the following article in the Microsoft Knowledge Base:

138138 INFO: Late, ID, Early Binding Types Possible in VB for Apps

For more information about early and late binding when using Automation, search the Help Index for "CreateObject Function."

For more examples of using Microsoft Graph with Microsoft Access, see the Graph Sample Database Grphsm97.exe. For information about how to obtain this sample file, please see the following article in the Microsoft Knowledge Base:

186855 ACC97: Microsoft Access 97 Sample Graphs Available in Download Center

For additional information about using early binding with Graph in Access 2000, click the article number below to view the article in the Microsoft Knowledge Base:

201710 ACC2000: Early Binding with Graph 9.0

Keywords: kbprb KB190735

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.