Previous Page

Additional Communication Solutions

Automation and OLE are relatively new technologies, and not all applications support them. Many applications that do not support Automation or OLE do support dynamic data exchange (DDE). If an application doesn't support DDE, it may be able to receive keystrokes from Microsoft Access. To determine whether an application supports Automation, OLE, DDE, or neither, consult the application's documentation.

Using Dynamic Data Exchange

If you are working with another application that does not support Automation or OLE, you may be able to use DDE to exchange data between that application and Microsoft Access. For example, you may want to use a communications program to periodically download data and store it in your database. You can use DDE to perform this operation automatically. You can also use DDE to run macro actions or macros in another application.

See Also   For more information on using DDE, search the Help index for "DDE."

Sending Keystrokes to Another Application

You can send keystrokes to any active Windows-based application, which behaves just as if you had typed them. Most of the time, sending keystrokes from Microsoft Access is only useful when you need to communicate with an application that does not support Automation, OLE, or DDE, such as Windows WordPad.

You use the SendKeys statement to send keystrokes to another application. For example, the following statement sends the keys "ABC" to the active application:

SendKeys "ABC", True

The second argument determines whether Microsoft Access processes the keystrokes immediately, or waits until the operating system has finished processing all other events. In the previous example, the keystrokes are processed immediately, before continuing with the rest of the code. If the second argument isn't specified, or if it is set to False, the keystrokes aren't sent until your procedure is idlethat is, until your Visual Basic code runs a DoEvents statement or until the procedure is completed.

If you want to send keystrokes that cannot simply be typed into a string, such as TAB or ENTER, you enclose the name of each key within braces ({}), as follows:

SendKeys "{TAB}{ENTER}"

See Also   For more information on the SendKeys statement, search the Help index for "SendKeys statement."

If the application you want to send keystrokes to is not active, then you need to use the AppActivate statement to switch to the other application. If the application is not already running, you need to start it by using the Shell function before you can switch to it.

See Also   For more information on the AppActivate statement or the Shell function, search the Help index for "AppActivate statement" or "Shell function."

© 1996 Microsoft Corporation. All rights reserved.

Next Page


Casa de Bender