Results 1 to 3 of 3
  1. #1
    Silver Lounger
    Join Date
    Jan 2002
    Posts
    1,615
    Thanks
    0
    Thanked 1 Time in 1 Post

    Query Filter Problem (2002)

    Hi,

    I have a control on a form that is used to filter information in a query. If the textbox is null than no filter should take place. If the textbox has data in it then the query should filter based on the information in the control. I have listed the sql below that I'm using. It works almost fine. When the textbox on the form is null, it shows all records with the exception of the records that were null. I'm not sure where to change the code so that if there is nothing entered in txtlocation on the form, all records show, including the records are null in that field.

    This is enter in the criteria for [location] in the query:

    Like IIf(IsNull([forms]![frmPhoneLog]![txtlocation]),"*",[forms]![frmPhoneLog]![txtlocation])ve a [txt

    Thanks,
    Leesha

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Query Filter Problem (2002)

    Try this expression in the Criteria line:

    [Forms]![frmPhoneLog]![txtlocation] Or [Forms]![frmPhoneLog]![txtlocation] Is Null

    When you save, close and reopen the query, Access will have spread the criteria over two lines; that is normal behavior, not something to worry about.

  3. #3
    Silver Lounger
    Join Date
    Jan 2002
    Posts
    1,615
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Query Filter Problem (2002)

    That worked beautifully, but then again I'm not surprised! Your stuff always does. Thanks for the warning on how the code would change appearance in the query once I opened and closed it. You know I would've had to "fix" it.

    Thanks again,
    Leesha

Posting Permissions

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