Microsoft KB Archive/105658
Article ID: 105658
Article Last Modified on 10/11/2006
- Microsoft Access 2.0 Standard Edition
- Microsoft Access 95 Standard Edition
This article was previously published under Q105658
Advanced: Requires expert coding, interoperability, and multiuser skills.
When you enter either the DDE() or the DDESend() function in the ControlSource property of a text box on a form, you may receive the following error message.
In Microsoft Access for Windows 95 version 7.0:
In Microsoft Access version 2.0:
This article assumes that you are familiar with Visual Basic for Applications and with creating Microsoft Access applications using the programming tools provided with Microsoft Access. For more information about Visual Basic for Applications, please refer to the "Building Applications With Microsoft Access For Windows 95" manual.
NOTE: Visual Basic for Applications (used in Microsoft Access for Windows 95 version 7.0) is called Access Basic in version 2.0. For more information about Access Basic, please refer to the "Building Applications" manual.
A reference to another control is being used for the application or topic argument in the function. Note that you can successfully include a control reference for the item or data argument.
The following example demonstrates how to create and use the sample Visual Basic for Applications or Access Basic functions newDDE() and newDDESend() in place of the DDE() and DDESend() functions:
Open a module and enter the following code:
Option Explicit Function newDDE (App, Topic, Item) Dim chan On Error GoTo ErrnewDDE chan = DDEInitiate(App, Topic) newDDE = DDERequest(chan, Item) DDETerminate chan ByenewDDE: Exit Function ErrnewDDE: newDDE = "#DDEERROR" Resume ByenewDDE End Function Function newDDESend (App, Topic, Item, DataToSend) Dim chan On Error GoTo ErrnewDDESend chan = DDEInitiate(App, Topic) DDEPoke chan, Item, DataToSend DDETerminate chan newDDESend = True ByenewDDESend: Exit Function ErrnewDDESend: newDDESend = False Resume ByenewDDESend End Function
- Start Microsoft Word for Windows, version 7.0. Save a new document as Test.
- Type a few lines of text in the document, and then select the text.
- Click Bookmark on the Edit menu. Type MyBookMark, and then press ENTER.
- Switch to Microsoft Access (leave Word for Windows running).
Create a new form with the following controls and properties:
Text box: Name: App Text box: Name: Topic Text box: Name: Item Text box: Name: Data Text box: Name: DDE ControlSource: =newDDE([App],[Topic],[Item]) Text box: Name: DDESend ControlSource: =newDDESend([App],[Topic],[Item],[Data]) Format: True/False
- On the View menu, click Form. Note that "#DDEError" appears in the DDE text box, and "False" appears in the DDESend text box. These messages occur because there are not yet valid application, topic, and item arguments.
- Create the following entries:
- With the insertion point in the DDE box, press F9 to force the function to refresh. Note that "Hello!" appears in the DDE box in place of "#DDEError."
This behavior is by design.
When the form is opened, Microsoft Access immediately establishes a DDE channel to the other application. This link uses the application and topic arguments in the function. The channel is kept open until the form is closed. Because the channel is open, the arguments necessary for opening the channel cannot be altered.
Microsoft Access does not open a new channel whenever it needs to call or refresh the control with the DDE() or DDESend() function. Doing so would impose significant overhead and could result in performance degradation.
Steps to Reproduce Behavior
- Create a blank, unbound form.
- Add a text box to the form.
Enter any of the following expressions in the text box's ControlSource property:
=DDE("winword",[topic],"my item") =DDE([app],"MyDoc","my item") =DDESend("winword",[topic],"my item, "my data") =DDESend([app],"MyDoc","my item, "my data")
Note that you receive the error message mentioned earlier in this article. Any reference to another control in the application or topic argument will generate this error.
For more information about sharing data between applications, search for "dynamic data exchange (DDE)," and then "Overview" using the Microsoft Access for Windows 95 Help Index.
Microsoft Access "User's Guide", version 2.0, pages 735, 740
Microsoft Access "Building Applications", version 2.0, pages 295-298
Keywords: kbprogramming KB105658