ACC2000: Error Previewing Subreports That Call Filter Macro
ID: Q209482
|
The information in this article applies to:
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 this to be a problem in the Microsoft products listed
at the beginning of this article.
MORE INFORMATION
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.
- On the File menu, click Save As, and save the report as MySubReport.
- Set the OnOpen property of the MySubReport report to the MyFilter macro.
- Close and save the changes to the MySubReport report.
- Open a new report not based on any table or query in Design View.
- Drag the MySubReport report to the detail section of this new report.
- 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.
- 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.
- 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.
Additional query words:
subreports reports subforms
Keywords : kberrmsg kbusage kbdta RptSub
Version : WINDOWS:2000
Platform : WINDOWS
Issue type : kbbug