ACC: Conditionally Run AutoExec Macro in Automation DatabaseLast reviewed: January 30, 1998Article ID: Q160951 |
The information in this article applies to:
SUMMARYAdvanced: Requires expert coding, interoperability, and multiuser skills. When you open a database in another instance of Microsoft Access using Automation code, if the database you are opening contains an AutoExec macro, the macro runs. If the macro contains a MsgBox action or opens a modal dialog box, code execution is suspended until you respond by closing the message box or the dialog box. This article demonstrates a technique to conditionally turn off any or all AutoExec macro actions when you open a database with Automation. 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 your version of the "Building Applications with Microsoft Access" manual.
MORE INFORMATIONIf there are actions in the AutoExec macro that you do not want to execute when you open the database with Automation, you can use the UserControl property in the Condition column of a macro action. The UserControl property lets you determine whether Microsoft Access is started by a user or through Automation.
Conditionally Excluding AutoExec Macro ActionsThe following example shows you how to use the UserControl property of the Application object to conditionally run an action in the AutoExec macro:
Suspending Code Execution by Opening a Message BoxThe following example demonstrates how code execution stops until you respond to a message box in a database opened with Automation:
REFERENCESFor more information about using Microsoft Access as an Automation Server, please see the following article in the Microsoft Knowledge Base:
ARTICLE-ID: Q147816 TITLE : ACC: Using Microsoft Access as an Automation ServerFor more information about the UserControl property, search the Help Index for "UserControl property," or ask the Microsoft Access 97 Office Assistant.
|
Additional query words: Blinking Frozen Freeze Stop Responding Hung OLE
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |