Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2003

    Unanswered: WhereCondition ignored when MS Access Form invokes Report

    I have a form with fields, and a button, whose onclick opens a report, using:

    DoCmd.OpenReport myReportName, acViewPreview, , myWhereCondition

    All is well: the report opens, and the parameters from the form appear correctly in the report header.

    However, the myWhereClause achieves nothing, and fails to cause the appropriate records to be filtered out of the report. Any ideas as to why?

    The whereCondition is simply "fieldName = 222222". Please note that I ran a query with the exact same whereCondition (SELECT * FROM tableName where fieldName = 222222"), and there, it does work.

  2. #2
    Join Date
    May 2004
    Those can be tough ones to figure out. My bug is normally the wrong number of commas (your example is correct). Also, you might try some simple things like putting square backets around the field name, hard code the where clause to try to get something simple to work. In short, get a simple test case to work first. The where clause does work.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts