Microsoft KB Archive/109705

= ACC: Starting Another Application from a Text Box on a Form =

Article ID: 109705

Article Last Modified on 1/18/2007

-

APPLIES TO


 * Microsoft Access 1.0 Standard Edition
 * Microsoft Access 1.1 Standard Edition
 * Microsoft Access 2.0 Standard Edition
 * Microsoft Access 95 Standard Edition
 * Microsoft Access 97 Standard Edition

-



This article was previously published under Q109705



Novice: Requires knowledge of the user interface on single-user computers.



SUMMARY
This article describes how you can start another application from a text box on a Microsoft Access form.

NOTE: This article explains a technique demonstrated in the sample files, FrmSampl.exe (for Microsoft Access for Windows 95 version 7.0) and FrmSmp97.exe (for Microsoft Access 97). For information about how to obtain these sample files, please see the following articles in the Microsoft Knowledge Base:

150895 ACC95: Microsoft Access Sample Forms Available in Download Center

175066 ACC97: Microsoft Access 97 Sample Forms Available in Download Center



MORE INFORMATION
You can start another application from a text box on a form by attaching a RunApp action to the text box's AfterUpdate property. The example below demonstrates how to start an application and load the file whose file name was typed in the text box. This example will start the Microsoft Word for Windows application and load the file from the Word for Windows folder:

  Create the following new macro and save it as Open Word:

NOTE: In the following example, an underscore (_) is used as a line-continuation character. Remove the underscore from the end of the line when re-creating this example.

     RunApp ---     Command Line: ="c:\winword\winword.exe c:\winword\" & _ Forms![formname]![controlname] & ".doc"

NOTE: This example assumes you have the Word for Windows application in a Winword folder on drive C on your computer. Make the appropriate changes to the example line above to point to the correct drive and folder for your computer.

NOTE: Microsoft Access 7.0 and 97 support long file names. If you are using long file names that contain spaces you will need to concatenate double quotation marks around what you are trying to run or open as shown in the following example:

     RunApp -     Command Line: ="c:\msoffice\winword\winword.exe " & Chr(34) & _ "c:\my documents\mydoc" & ".doc" & Chr(34)  Add a text box to a form. Set the text box's AfterUpdate property to the Open Word macro. View the form in Form view. Type the name of a file that is in your Word for Windows folder in the text box without the .doc extension, and then press ENTER. For example, for a file named Test.doc you would type test in the text box.</li></ol>

<div class="references_section">