ACC97: Cannot Use Early Binding with Graph 8.0 Using Automation

ID: Q190735


The information in this article applies to:


SYMPTOMS

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

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:

Q138138 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:

Q186855 ACC97: Microsoft Access 97 Sample Graphs Available on MSL


Keywords          : kbdta AutoGrph 
Version           : WINDOWS:97
Platform          : WINDOWS 
Issue type        : kbprb 

Last Reviewed: April 27, 1999