Is "*" a Yes/No Wildcard?

  • Thread starter Thread starter Gary Schuldt
  • Start date Start date
G

Gary Schuldt

I'm doing a QBF. I have a Yes/No field ynF as a parameter in the query.

ynF can either be Yes, No, or Null.

If in the QBF the user doesn't care about the value of ynF, can I place a
"*" into the Critera cell in the QBE pane for the underlying query? Or a
null value?

Thanks for the help.

Gary
 
Gary

If you don't care what's in the field, don't put anything in the criterion
cell.
 
Jeff,

If I were writing one query in this situation, I would do what you
suggested.

But I am using a Query By Form approach, so I need to let the user decide
whether or not they want to select on this criterion.

Following Steve Schapel's suggestion, I am using the following code in the
criterion cell for a Text field (where the user is using a comboBox to
select the value):

Like Nz([Forms]![NameOfForm]![NameOfCombobox],"*")

To handle an "<All>" situation for these, I'm modifying the above criterion
to read:

Like Nz(IIF(NameOfCombobox="<All>", Null, NameOfCombobox) ,"*")

For the Yes/No field ynF, Emilia Maxim suggested:

RecordSourceType: Value list
RecordSource: Null;"Don't Care";-1;"Yes";0;"No"
Bound Column: 1
Column Width: 0;0.5

If I do that, how do I code the corresponding Query criterion cell: Just as
[Forms]![NameOfForm]![ynF], or do I have to substitute something else (like
"*") if ynF is Null?

Gary
 
I'm doing a QBF. I have a Yes/No field ynF as a parameter in the query.

ynF can either be Yes, No, or Null.

If in the QBF the user doesn't care about the value of ynF, can I place a
"*" into the Critera cell in the QBE pane for the underlying query? Or a
null value?

If ynF is Null, simply don't include any criterion at all; or if this
is awkward, use a criterion of

=yNF OR yNF IS NULL
 
John,

re: =yNF OR yNF IS NULL

Do you mean test the field value against itself (or Null) to ensure a "True"
result?

That IS clever! :-)

Gary
 
John,

re: =yNF OR yNF IS NULL

Do you mean test the field value against itself (or Null) to ensure a "True"
result?

That IS clever! :-)

No... I misunderstood the names! I'm suggesting testing the *form
control* you're using as a criterion to see if it is NULL.
 
John,

Here's the QBE form control ValueList setup for the Yes/No field:

RecordSource: Null;"Don't Care";-1;"Yes";0;"No"
Bound Column: 1
Column Width: 0;0.5


In the QBE design pane, I have to code a criterion expression that will
handle all three situations (yes, no, don't care(all)), depending on what
the user selects on the QBF form. That is my problem.

Now I'm thinking I'll have to enumerate all the possibilities in the "don't
care" or no selection, something like:

Criterion: IIF(IsNull([Forms]![NameOfForm]![ynF]), "=-1 OR 0 OR IsNull",
[Forms]![NameOfForm]![ynF])

Gary
 
Now I'm thinking I'll have to enumerate all the possibilities in the "don't
care" or no selection, something like:

Criterion: IIF(IsNull([Forms]![NameOfForm]![ynF]), "=-1 OR 0 OR IsNull",
[Forms]![NameOfForm]![ynF])

No. You won't.

A criterion of

= [Forms]![NameOfForm]![ynF] OR [Forms]![NameOfForm]![ynF] IS NULL

will work. If the ynF control is NULL then the second clause of the OR
will be true (and therefore the first will be ignored); if it's not
null then it must match.
 
Thanks, John. It makes sense.

I'll give it a try.

Gary

John Vinson said:
Now I'm thinking I'll have to enumerate all the possibilities in the "don't
care" or no selection, something like:

Criterion: IIF(IsNull([Forms]![NameOfForm]![ynF]), "=-1 OR 0 OR IsNull",
[Forms]![NameOfForm]![ynF])

No. You won't.

A criterion of

= [Forms]![NameOfForm]![ynF] OR [Forms]![NameOfForm]![ynF] IS NULL

will work. If the ynF control is NULL then the second clause of the OR
will be true (and therefore the first will be ignored); if it's not
null then it must match.
 
Back
Top