Microsoft KB Archive/234303

= ACC2000: How to Start Another Application from a Data Access Page =

Article ID: 234303

Article Last Modified on 6/29/2004

-

APPLIES TO


 * Microsoft Access 2000 Standard Edition

-



This article was previously published under Q234303



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

This article applies to a Microsoft Access database (.mdb) and to a Microsoft Access project (.adp).



SUMMARY
This article shows you how to start another application from a Microsoft Access data access page.



MORE INFORMATION
The following example demonstrates how to start an application and to load a file whose name you type in a text box. This example starts Microsoft Word for Windows and loads a document that you specify.  Start Microsoft Access, and open any database. In the Database window, click Pages under Objects, and then click New. In the New Data Access Page box, click Design View, and then click OK. Place a text box in the Section: Unbound section of the page.  Set the following properties for the text box:   Id: txtApp Left: 2in Top: 0.5in Width: 1in   Set the following properties for the text box label: <pre class="fixed_text">  FontWeight: bold InnerText: Application Name: Left: 0in TextAlign: right Top: 0.5in Width: 2in </li> Place another text box in the Section: Unbound section of the page.</li>  Set the following properties for this text box: <pre class="fixed_text">  Id: txtDoc Left: 2in Top: 0.75in Width: 4in </li>  Set the following properties for the text box label: <pre class="fixed_text">  FontWeight: bold InnerText: Path and File Name: Left: 0in TextAlign: right Top: 0.75in Width: 2in </li> Place a command button in the Section: Unbound section of the page.</li>  Set the following properties for the command button: <pre class="fixed_text">  Id: cmdOpenApp FontWeight: bold InnerText: Open App Left: 2.5in Top: 1in </li> Place another command button in the Section: Unbound section of the page.</li>  Set the following properties for the command button: <pre class="fixed_text">  Id: cmdCloseApp FontWeight: bold InnerText: Close App Left: 2.5in Top: 1.25in </li> On the File menu, click Save, and save the page as LaunchApp.htm. Make a note of the folder where this file is saved. You will need this information later in these steps.</li> On the Tools menu, point to Macro, and then click Microsoft Script Editor.</li>  On the HTML menu, point to Script Block, and then click Client. Insert the following script: <SCRIPT language=vbscript>

</SCRIPT> </li>  Using the Script Outline, insert the following script for the OnClick event of the cmdOpenApp command button: <SCRIPT event=onclick for=cmdOpenApp language=vbscript>

</SCRIPT> </li>  Using the Script Outline, insert the following script for the OnClick event of the cmdCloseApp command button: <SCRIPT event=onclick for=cmdCloseApp language=vbscript>

</SCRIPT> </li> Close the Microsoft Script Editor and Microsoft Access, and when prompted, click Yes to save changes.</li> Start Microsoft Internet Explorer 5 or later.</li> On the File menu, click Open.</li> <li>Click Browse and locate the folder where the LaunchApp.htm file is stored.</li> <li>Click LaunchApp.htm and click Open.</li> <li>Click OK and type Word in the Application Name text box.</li> <li>In the next text box, type a path and file name to some Word document, such as C:\Windows\Script.doc.</li> <li>Click Open App. Note that Word starts and opens the document that you specified.</li> <li>Click Close App to quit Word.</li></ol>

Keywords: kbhowto kbdap kbdapscript KB234303

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.