Re: SQL Query with Iff and Wild Card



Probably

Like IIf(Forms![VulnerableEntitySelect]![Type] Is Not
Null,Forms![VulnerableEntitySelect]![Type],"*")

That will work as long as your field doesn't contain nulls. If the field
has nulls then the records where the field is null will not be shown.

If you need ALL records then try the following criteria

WHERE TheField = Forms![VulnerableEntitySelect]![Type] OR
Forms![VulnerableEntitySelect]![Type] Is Null

"Randy Hartwick" <RandyHartwick@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:10014242-1AC9-4284-B36D-D0C35FDA8604@xxxxxxxxxxxxxxxx
>I am trying to use the results from a form to build an SQL Query. The form
> has combo box's to select a value that is updated to a table that is in
> turn
> used as the selection criteria of the query. When I select a value the
> criteria in the query works fine. When the selection is blank (i.e. I
> should
> view all records) I don't see any records. The statement in the query is:
>
> IIf([VulnerableEntitySelect]![Type]<>"",[VulnerableEntitySelect]![Type],"*")
>
> I have tried using the asterick without the quotes and tried using null in
> place of "*" with no luck.
>
> What should I be using?
>
> Thanks,
>
> Randy
>


.



Relevant Pages

  • Re: Help creating a query
    ... I find it much more straighforward to create a "base query" without any ... criteria, and then enhance its SQL in VBA code with criteria that I obtain ... just do not create selection criteria in the WHERE clause you are building. ...
    (comp.databases.ms-access)
  • RE: Null or No Null values in a parameter query
    ... IIf([Press ENTER for nulls, 'N" not nulls] Is Null,1,0) test if ... All criteria on the same line must be met -- they are AND'd together. ... I can see that a field called 1 was added to my query with a ... "KARL DEWEY" wrote: ...
    (microsoft.public.access.gettingstarted)
  • Re: Multiple search Criteria
    ... IF the field you are searching against always has a value (no nulls allowed) and the field is a text field then you can use criteria like the following. ... The problem with the alternative above is that if you use the construct many times the query will quickly grow too complex and will not run. ...
    (microsoft.public.access.queries)
  • RE: Query by Form
    ... not handle Nulls. ... results of the query are displayed in a subform in the above mentioned form. ... By using the following criteria in each of the fields in my query (Like ...
    (microsoft.public.access.queries)
  • Re: Selecting a Date Range For a REport
    ... One simple thing you could do is in the query under you date field to ... enter the criteria ... It's convenient to base a second Form or Report on the resulting query to ... query's selection criteria to "point" to the form on which your users are ...
    (microsoft.public.access.gettingstarted)