Results 1 to 3 of 3
  1. #1
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts
    I often provide a list form with the capacity to filter and sort, then a Print button that passes the current filter and sort order to a Report for printing the list.

    I attach a demo.

    [attachment=88138:filtersort.gif]

    The column headings act as Sort buttons, and you can filter by School. Once a filter is applied, a Clear Filter button becomes visible that will remove the filter with:

    Code:
    Me.Filteron=False
    Me.filter=""
    The Problem
    If I apply a Filter, then Clear it, then Sort, the filter that I have just removed reappears again when I go to the Report.
    Why?

    It seems that Access ignores the Me.Filter="" line.

    I have a workaround for this, but I feel that I should not need it.
    (In the Print button code, I can test for me.filteron =true.)

    [attachment=88139:FilterandSort.zip]
    Attached Images Attached Images
    Attached Files Attached Files
    Regards
    John



  2. #2
    2 Star Lounger
    Join Date
    Sep 2002
    Location
    Chicago, Illinois, USA
    Posts
    116
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I agree with you, John, that you should not need a workaround.
    What I found is that while changing the OrderBy value the old FilterBy value gets restored. Interestingly though, the FilterByOn value of False is retained during these steps. However, if you set the OrderByOn value to False before changing the OrderBy value then the FilterBy property is undisturbed. I think if you simply add the statement Me.OrderByOn = False to the beginning of your fnSort function then your report will display as you would like.

  3. #3
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts
    Thanks for that. You are absolutely correct that putting in Me.OrderByOn=False into the Sort function fixes things up. This seems about as bizarre as the original problem but is worth knowing.

    I use form filters a lot, but I came across a post somewhere else recently in which an Access MVP said that forms filters were notoriously "flaky". (I can't find it now)
    Regards
    John



Posting Permissions

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