Comparing OLE and DDE

OLE and DDE allow you to perform similar actions. Both enable you to send commands to another application, perform actions in that application, and return data to your Microsoft Access application. There are, however, some fundamental differences between OLE and DDE.

To illustrate some of the differences, consider a Microsoft Access application you've designed in which the user has access to a particular Microsoft Excel worksheet. Your Microsoft Access application contains the worksheet. In OLE operations, program control is actually temporarily transferred to Microsoft Excel for the purpose of manipulating the worksheet data. With DDE, operations occur when Microsoft Access sends a command to Microsoft Excel to start communication between the two applications. Microsoft Access, however, always has program control.

Another difference, which is an advantage of OLE, is that OLE automatically starts the object application when program control is transferred to the object application. When you use DDE, you must check to see if the source application (the DDE object) is started, and start it if necessary.

In addition, with OLE the data always is displayed in a bound or unbound object frame as it appears in the application that created the object. For example, if the object application is Microsoft Excel, a bound or unbound object frame displays worksheet data in your Microsoft Access application (the client application) as it appears in Microsoft Excel itself. By itself, DDE doesn't know anything about how to display the worksheet.

Lastly, with OLE you can also allow the user to edit data in another application (activate that application) when the user double-clicks on the bound or unbound object frame containing the OLE object. DDE doesn't provide this feature because DDE can only activate other applications through Access Basic.

Via OLE Automation, it's easy to access and manipulate data in an OLE object, as long as the application that supplies the object also supports OLE Automation. If you want programmatic access to data in an application that doesn't support OLE Automation, you may still have to use DDE.

In short, OLE defines services well beyond those of DDE and should be used whenever possible.