ACC2000: Starting Another Application from a Text Box on a Form (209170)



The information in this article applies to:

  • Microsoft Access 2000

This article was previously published under Q209170
Novice: Requires knowledge of the user interface on single-user computers.

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

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 file, FrmSmp00.mdb. For information about how to obtain this sample file, please see the following article in the Microsoft Knowledge Base:

233324 Microsoft Access 2000 Sample Forms Database 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 AfterUpdate property of the text box. The following example 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.
  1. Create the following macro:
       Macro Name Condition  Action
       --------------------------------
       Open Word             RunApp
       
       Open Word Action Arguments
       -------------------------------
       Command Line: ="c:\Program Files\Microsoft Office\Office\ 
          winword.exe c:\My Documents\" & Forms![formname]![controlname]
    						
    NOTE: This example assumes the default installation of Word for Windows. Make sure the Command Line above points to the correct drive and folder where winword.exe is located on your computer.
  2. Add a text box to a form.
  3. Set the AfterUpdate property of the text box to the Open Word macro.
  4. View the form in Form view.
  5. Type the name of a file that is in your Word for Windows folder in the text box, including the .doc extension, and then press ENTER. For example, for a file named Test.doc you would type Test.doc.

REFERENCES

For more information about RunApp action, click Microsoft Access Help on the Help menu, type RunApp in the Office Assistant or the Answer Wizard, and then click Search to view the topic.

Modification Type:MajorLast Reviewed:6/28/2004
Keywords:kbinfo KB209170