Results 1 to 4 of 4

Thread: Filter By Form

  1. #1
    Join Date
    Jun 2004
    Posts
    8

    Unanswered: Filter By Form

    I tried to run code using "acFilterByForm", though it blanked the form, it didnt work the same as by clicking the Filter by Form button on the menu bar. Why is it so? Do I have to add any code? Thanks.

  2. #2
    Join Date
    Jun 2004
    Location
    Terrapin Nation
    Posts
    205
    You have to set a string expression for what you want to filter like:

    strFilter = "[Your Field as it is in your query] = '" & someStringValue & "'"


    then turn the filter on like:

    Me.Filter = strFilter
    Me.FilterOn = True

  3. #3
    Join Date
    Jun 2004
    Posts
    8
    Thanks for the reply, TerpInMD.
    But what I meant is, what code to write to activate FILTERBYFORM.
    I disabled all menus. You know, there are "not so computer interested" users who cannot remember what buttons to press. So I wanted to create limited number of command buttons on the form for these kind of users.
    I found out that the code "Run Command acCmdFilterByForm" works equally.
    But then, it disabled all objects in the form except the FIELDS where you type in data you want to use as filters. I created a command button to run "Apply Filter" but it was disabled too. And I can't enable it. I tried many tricks but the message "You cannot assign a value to this object." appears everytime while you are in the FilterByForm condition. Is there a way to enable a button? Or am I stucked to just show the menu buttons?

  4. #4
    Join Date
    Jun 2004
    Posts
    96
    you can also create custom toolbar/menus too..

Posting Permissions

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