Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2005
    Location
    Omaha, NE
    Posts
    4

    Unhappy Unanswered: Problem with Query criteria from combo boxes

    I have a form with 5 combo boxes for the user to select query criteria. I would like the user to be able to select any combination of values for the query to include selecting no values (i.e. return all records). Combo box values can include null or "" values. I check for the null or "" values and am trying to replace those values with a <Like "*"> value so that I can return all records for that particular field along with any other query criteria. I have tried both Nz and IIf statements but the Truepart returns "Like "*"" (quotes on either side) for the criteria, which returns no records. How do I replace null or "" combo box values to be able to return all records for that field? The query works if I have actual combo box values selected. My Nz statement looks like: strAction=Nz((Forms]![Search]!cboAction), "*") ; my IIf is strAction=IIf(((IsNull([Forms]![Search]!cboAction) or [Forms]![Search]!cboAction=""0), "*", [Forms]![Search]!cboAction). I am passing the strAction value to the Query criteria. Its the "*" value I am having problems with.

  2. #2
    Join Date
    Sep 2005
    Location
    Utah
    Posts
    136
    I use this syntax and it always works for me.

    [forms]![FormName]![ControlName] Or Like [forms]![FormName]![ControlName] Is Null

  3. #3
    Join Date
    Dec 2005
    Location
    Omaha, NE
    Posts
    4
    Zenaida, thanx!..that was almost too easy rclocke

Posting Permissions

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