Microsoft KB Archive/172090

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

Article ID: 172090

Article Last Modified on 1/20/2007

-

APPLIES TO


 * Microsoft Office 97 Developer Edition
 * Microsoft Access 97 Standard Edition

-



This article was previously published under Q172090



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



SYMPTOMS
When you try to open a form in Filter-by-Form view programmatically in a Microsoft Access 97 run-time application, you may receive the following error message

Run-time error '2501': The RunCommand action was canceled.

followed by:

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 unavailable in a Microsoft Access 97 run-time application.



RESOLUTION
For more information about simulating Filter-by-Form in a run-time application, please see the following article in the Microsoft Knowledge Base:

166634 ACC97: Filter-by-Form Example for Run-Time Apps Available in Download Center



MORE INFORMATION
In Microsoft Access 7.0, Filter-by-Form works in both the full version and the run-time version. However, the Filter-by-Form functionality wasn't designed to be available in a Microsoft Access 7.0 run-time application.

Steps to Reproduce Behavior
CAUTION: Following these steps will modify the sample database Northwind.mdb. You may want to back up the Northwind.mdb file and perform these steps on a copy of the database.  Open the sample database Northwind.mdb, and open the Customers form in Design view. Add a command button to the form. Change the Name property for the command button to btnFilter.  Place the following code in the OnClick event procedure of the command button: Private Sub btnFilter_Click DoCmd.RunCommand acCmdFilterByForm End Sub  Close and save the form.</li> On the Tools menu, click Startup.</li> Under Display Form, select Customers from the list, and then click OK.</li>  On the Start menu, click Run, and then type the following command.

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 typing this command.

NOTE: In the following sample, replace C:\Program Files\Microsoft Office\Office\ with the path to where Msaccess.exe is located on your hard drive. <pre class="fixed_text">     "C:\Program Files\Microsoft Office\Office\Msaccess.exe" _ "C:\Program Files\Microsoft Office\Office\Samples\Northwind.mdb" _ /Runtime </li> When the Customers form opens, click the button that you created in step 2.

Note that the filter-by-form view does not come up, and you receive the errors listed in the "Symptoms" section.</li></ol>

Additional query words: ODE Raid Sweep run time error 2501

Keywords: kberrmsg kbhowto kbprb kbusage KB172090

-

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

© Microsoft Corporation. All rights reserved.