Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

ACC2000: Error Previewing Subreports That Call Filter Macro


View products that this article applies to.

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.

↑ Back to the top


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.

↑ Back to the top


Status

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

↑ Back to the top


More information

Steps to Reproduce Problem

  1. Start Microsoft Access and open the sample database Northwind.mdb.
  2. Create a new macro that carries out an ApplyFilter action. Type the following criteria in the Where Condition:
    [CustomerID]="BERGS"
  3. Close and save the macro as MyFilter.
  4. In the Database window, click Tables under Objects, and then select the Orders table.
  5. On the Insert menu, click AutoReport.
  6. On the File menu, click Save As, and save the report as MySubReport.
  7. Set the OnOpen property of the MySubReport report to the MyFilter macro.
  8. Close and save the changes to the MySubReport report.
  9. Open a new report not based on any table or query in Design View.
  10. Drag the MySubReport report to the detail section of this new report.
  11. 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.
  12. 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.
  13. 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.

↑ Back to the top


Article Info
Article ID : 209482
Revision : 2
Created on : 1/1/0001
Published on : 1/1/0001
Exists online : False
Views : 272