locked
Opem a filtered form? RRS feed

  • Question

  • Hello, I have the following issue/question:

    I have a Welcome Page (form) on which I have a button "Main Page" ; when this button is clicked, I would like it to open the "Main Page" form, but display "Active" registrants only; should be straight forward, but does not work for me. On click of the button, the form still displays all registrants, "Active", "On Hold" and "Archived", instead of filtering and displaying only the "Active". Grateful for any idea what I might be doing wrong!

    Here is the code I use for the button:

    Private Sub Commande19_Click()
       DoCmd.OpenForm "Main_page", WhereCondition:="[Status] Like ""*Active*"""
    End Sub

    Thursday, June 20, 2019 4:13 PM

Answers

  • On the basis of the information available, I don't see why the current string expression isn't working.  However, why are you using pattern matching when the possible values seem to be a fixed set, rather than "Status = ""Active"""?

    Is there any code in the Main_page form's module, or a macro, which could be turning off the filter, e.g. by setting the FilterOn property to False?

    Ken Sheridan, Stafford, England

    • Marked as answer by Access_fan Friday, June 21, 2019 10:05 PM
    Thursday, June 20, 2019 4:43 PM

All replies

  • On the basis of the information available, I don't see why the current string expression isn't working.  However, why are you using pattern matching when the possible values seem to be a fixed set, rather than "Status = ""Active"""?

    Is there any code in the Main_page form's module, or a macro, which could be turning off the filter, e.g. by setting the FilterOn property to False?

    Ken Sheridan, Stafford, England

    • Marked as answer by Access_fan Friday, June 21, 2019 10:05 PM
    Thursday, June 20, 2019 4:43 PM
  • I'd try

    DoCmd.OpenForm "Main_page", acNormal, , "[Status] = 'Active'"
    Also, is Status not a related table related by StatusId for instance?  If so, you should filter on the PK/FK instead.

    Daniel Pineault, 2010-2018 Microsoft MVP
    Professional Support: http://www.cardaconsultants.com
    MS Access Tips and Code Samples: http://www.devhut.net

    Thursday, June 20, 2019 5:11 PM
  • Yes, that solved it! I had apparently a couple of filters (On Load and On Open)set to False; once changed to "TRUE" everything worked! Thank you!
    Friday, June 21, 2019 10:07 PM