Results 1 to 4 of 4
  1. #1
    2 Star Lounger
    Join Date
    Nov 2004
    Location
    Lexington Park, Maryland, USA
    Posts
    119
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Queries with criteria including null values (Access 2000)

    How do I make a query include records when the criteria is in a field where there are Null values?

    criteria: Like "*" & [Forms]![Search]![txt_1] & "*"

    I am using this "[0-z]*" in the txt_1 text box in the search form to grab all records. This does not grab records with null values.

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

    Re: Queries with criteria including null values (Access 2000)

    Like "*" & [Forms]![Search]![txt_1] & "*" Or Is Null

  3. #3
    2 Star Lounger
    Join Date
    Nov 2004
    Location
    Lexington Park, Maryland, USA
    Posts
    119
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Queries with criteria including null values (Access 2000)

    That almost works. I need the query to return null values only when the text box's value is "[0-z]*" The code you supplied me returns records with null values when the text box value is "[0-z]*" and anything else.

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

    Re: Queries with criteria including null values (Access 2000)

    Like "*" & [Forms]![Search]![txt_1] & "*" Or [Forms]![Search]![txt_1] = "[0-z]*"

    Note: when you save an reopen the query, Access will have rearranged the criteria. This is normal behavior and nothing to worry about.

Posting Permissions

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