Microsoft KB Archive/306361

= OFFXPDEV: Filter By Form Is Not Available in Run-Time Applications =

Article ID: 306361

Article Last Modified on 2/12/2007

-

APPLIES TO


 * Microsoft Office XP Developer Edition
 * Microsoft Access 2002 Standard Edition

-



This article was previously published under Q306361



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

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

For a Microsoft Office 2000 Developer Edition version of this article, see 262094.



SYMPTOMS
If you programmatically open a form in Filter-by-Form view in a Microsoft Access 2002 run-time application, you may receive the following error message:

Execution of this application has stopped due to a run-time error. The application can't continue and will be shut down.



CAUSE
The Filter-by-Form commands are not available in a Microsoft Access 2002 run-time application.



RESOLUTION
For additional information about simulating Filter-by-Form in a run-time application, click the article number below to view the article in the Microsoft Knowledge Base:

262099 ACC2000: Filter-by-Form Example for Run-Time Applications Available in the Download Center

Even though this example was created using Access 2000, the code still works in Access 2002.



Steps to Reproduce the Behavior
CAUTION: If you follow the steps in this example, you modify the sample database Northwind.mdb. You may want to back up the Northwind.mdb file and follow these steps on a copy of the database.

 In the sample database Northwind.mdb, open the Customers form in Design view. Add a command button to the form. Change the Name property of the command button to btnFilter.  Set the OnClick property of the command button to the following event procedure: Private Sub btnFilter_Click DoCmd.RunCommand acCmdFilterByForm End Sub  Save the form, and then close it.</li> On the Tools menu, click Startup.</li> Under Display Form, click Customers in the list, and then click OK.</li> Click Start, click Run, and then type the following command in the Open box.

NOTE: In the following sample, an underscore (_) at the end of a line is used as a line-continuation character. Remove the underscore from the end of the line when you type this command.

NOTE: If Microsoft Office is not installed in the default location of C:\Program Files\Microsoft Office\Office10\, change the following path to where Msaccess.exe is located on your computer:

&quot;C:\Program Files\Microsoft Office\Office10\Msaccess.exe&quot; _

&quot;C:\Program Files\Microsoft Office\Office10\Samples\Northwind.mdb&quot; _

/Runtime

</li> When the Customers form opens, click the command button that you created in step 2.

Note that the Filter-by-Form view does not appear and that you receive the error message mentioned in the &quot;Symptoms&quot; section of this article.</li></ol>

Keywords: kbbug kberrmsg KB306361

-

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

© Microsoft Corporation. All rights reserved.