All or Filtered using a CheckBox

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • robboll

    All or Filtered using a CheckBox

    Access 2003

    I have a form (bound to a query) and would like for the user to check
    a CheckBox to filter records based on a value of one of the fields.
    If the CheckBox is not checked, it should show all the records. Here
    is the query criteria I am using:

    IIf([forms]![frmViolations]![Check156]=True,[forms]![frmViolations]!
    [txtStation],"*")

    The action this line is performing:

    If the checkbox on the form is checked (i.e., True), the query uses
    the value of the control txtStation (That works), but if it is
    unchecked, the "*" doesn't work. It returns nothing. "??" doesn't
    work either.

    The alternative is to use a seperate recordsource altoghether, which I
    am trying to avoid. Any suggesting greatly appreciated!!!

    RBolling
  • fredg

    #2
    Re: All or Filtered using a CheckBox

    On Mon, 11 Feb 2008 16:36:58 -0800 (PST), robboll wrote:
    Access 2003
    >
    I have a form (bound to a query) and would like for the user to check
    a CheckBox to filter records based on a value of one of the fields.
    If the CheckBox is not checked, it should show all the records. Here
    is the query criteria I am using:
    >
    IIf([forms]![frmViolations]![Check156]=True,[forms]![frmViolations]!
    [txtStation],"*")
    >
    The action this line is performing:
    >
    If the checkbox on the form is checked (i.e., True), the query uses
    the value of the control txtStation (That works), but if it is
    unchecked, the "*" doesn't work. It returns nothing. "??" doesn't
    work either.
    >
    The alternative is to use a seperate recordsource altoghether, which I
    am trying to avoid. Any suggesting greatly appreciated!!!
    >
    RBolling
    Try:
    Like IIf(Forms!![frmViolations]![Check156]=True,"*",
    [forms]![frmViolations]![txtStation])

    The form must be open when this is run.
    --
    Fred
    Please respond only to this newsgroup.
    I do not reply to personal e-mail

    Comment

    Working...