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

    Unanswered: What's the filter by form code?

    I'm new in working with Access and I would like to know how to create a command button that makes the same action as the filter by form?

    Can anyone help me?


  2. #2
    Join Date
    Dec 2002
    Préverenges, Switzerland
    i've never bothered with filter by form so i may be barking up entirely the wrong tree, but here's what i do to get a subset of data in my forms.

    make a form
    add a bunch of unbound text boxes in pairs
    one of each pair is hidden, the other not
    the user plays with the not-hidden half... entering contiguous substrings for his "filter" settings or leaving the box blank for "any".

    add a button "reset"
    on buttonReset_click
    reset all visible boxes to null

    add a button "filter"
    on buttonFilter_click
    visit each of the visible boxes...
    if isnull(visibleBox.value) then
    hiddenBox.value = "*"
    hiddenBox.value = "*" & visibleBox.value & "*"

    make a query
    criteria (each field for which you have box-pairs) is
    like hiddenBox.value

    i much prefer this to parameter queries or other in-built mechanisms since it allows code to inspect/protest/correct user input before launching the query.


Posting Permissions

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