Microsoft KB Archive/209482

= ACC2000: Error Previewing Subreports That Call Filter Macro =

Article ID: 209482

Article Last Modified on 7/16/2004

-

APPLIES TO


 * Microsoft Access 2000 Standard Edition

-



This article was previously published under Q209482



Moderate: Requires basic macro, coding, and interoperability skills.



SYMPTOMS
When you print a form or a report that contains a subform/subreport that calls an ApplyFilter macro action in its OnOpen event, you receive the following error message:

The action or method is invalid because the form or report isn't bound to a table or query.

Even if you do not receive this error message, you see that the ApplyFilter action has not been carried out.



CAUSE
When printing, Microsoft Access erroneously tries to apply the filter that is run from the macro to the outermost (main) report/form, rather than to the subreport/subform.

The error occurs because the main report/form does not contain a RecordSource property setting to perform the ApplyFilter action against.



STATUS
Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.



Steps to Reproduce Problem
 Start Microsoft Access and open the sample database Northwind.mdb. Create a new macro that carries out an ApplyFilter action. Type the following criteria in the Where Condition:

[CustomerID]="BERGS"

 Close and save the macro as MyFilter. In the Database window, click Tables under Objects, and then select the Orders table. On the Insert menu, click AutoReport.</li> On the File menu, click Save As, and save the report as MySubReport.</li> Set the OnOpen property of the MySubReport report to the MyFilter macro.</li> Close and save the changes to the MySubReport report.</li> Open a new report not based on any table or query in Design View.</li> Drag the MySubReport report to the detail section of this new report.</li> Save this new report as MyMainReport and preview the report. Note that you receive the following error message:

The action or method is invalid because the form or report isn't bound to a table or query.

</li> Change the RecordSource property of the MyMainReport report to point to the Customers table and add the CustomerID field to the detail section of the MyMainReport report.</li> Save the change and preview the MyMainReport report again. Note that the error message no longer occurs; however, neither the subreport nor the main report has been filtered.</li></ol>

Additional query words: subreports reports subforms the action or method is invalid because the form or report isn t bound to a table or query

Keywords: kberrmsg kbbug kbpending kbusage KB209482

-

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

© Microsoft Corporation. All rights reserved.