Results 1 to 3 of 3
  1. #1
    2 Star Lounger
    Join Date
    Mar 2001
    Location
    Colorado, USA
    Posts
    144
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Filtering a Report Doesn't Seem to Work (Access 2000)

    I've got a report in which I want to filter out all records except those which are current and active. I have entered the following filter expression on the report's property sheet and set FilterOn to true.

    "(([Active] = True) And ([Yearnum] = " & DateSerial(Year(Now()), 1, 1) & "))"

    [Active] and [Yearnum] are fields in the RecordSource for the report, but are not actually fields in the report.

    Now, it seems to me that when I preview the report I should see the results with this filter active, but that isn't happening. Instead I get all the records. If I go to the Record Source query and insert the same criteria, it works fine. Moreover, the SQL WHERE clause looks nearly the same (only table names are added to field names).

    Does anyone have an idea of what might be going on?

    Thanks.

  2. #2
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Filtering a Report Doesn't Seem to Work (Access 2000)

    You aren't putting quotes in the property sheet are you? That isn't the way it works. If you're setting the filter from code, post the code so we can tell what's wrong with it. In the property sheet, you would have to enter (no quotes)

    (([Active = True) And ([Yearnum]=2002))
    Charlotte

  3. #3
    2 Star Lounger
    Join Date
    Mar 2001
    Location
    Colorado, USA
    Posts
    144
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Filtering a Report Doesn't Seem to Work (Access 2000)

    Yep, you nailed it. I had the quotes in there. I guess that means it was looking for the string?

    Anyway it works now. Thanks for the help.

Posting Permissions

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