ACC: Error Previewing Subreports That Call Filter Macro

Last reviewed: May 28, 1997
Article ID: Q103131
The information in this article applies to:
  • Microsoft Access versions 1.0, 1.1, 2.0, 7.0, 97

SYMPTOMS

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

When you print a form or report which 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, note that the ApplyFilter action has not been executed.

CAUSE

When printing, Microsoft Access erroneously attempts 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 Microsoft Access 1.0, 1.1, 2.0, 7.0, and 97. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

Steps to Reproduce Problem

  1. Start Microsoft Access and open the sample database Northwind.mdb (or NWIND.MDB in Microsoft Access 2.0 or earlier).

  2. Create a new macro that executes an ApplyFilter action. Type a criteria such as the following for the Where Condition:

    In Microsoft Access 7.0 and 97:

          [LastName]="Fuller"
    

    In Microsoft Access 1.x and 2.0:

          [Last Name]="Fuller"
    

  3. Create a new report not based on any table or query.

  4. Drag the Employee Sales By Country report from the Database window to create a subreport on the new report.

  5. Double-click the subreport to edit it. Set the OnOpen property of the subreport to the macro that you created in step 2 from the combo box.

  6. Preview the report. Note that you receive the following error message.

    In Microsoft Access 7.0 and 97:

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

    In Microsoft Access 1.x and 2.0:

          Action isn't valid because the form or report isn't bound
          to a table or query.
    

  7. Change the RecordSource property of the main report to point to the Employees table.

  8. Preview the report. Note that the error message no longer appears; however, neither the subreport nor the main report have been filtered.


Additional query words: subreports reports subforms
Keywords : kberrmsg kbusage RptSub
Version : 1.0 1.1 2.0 7.0 97
Platform : WINDOWS
Hardware : X86
Issue type : kbbug
Resolution Type : Info_Provided


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: May 28, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.