Yes/No parameter for Yes or No or Both

O

Owl

RonaldoOneNil gave me the very useful info of:

=IIF([Enter Yes or No]="Yes",True,False)

for a parameter query criterion (for a check box in a form).

I would like to know if I can enter Yes or No AND have the option for both.
Presumably it would be in the Or row, but I don't know what to enter.

Thanks for any help.
 
O

Owl

Thanks for your reply.

I have a form F00 based on a query Q00. In the form there is a field called
MatterClosed which is a Yes/No check box. If I put the above expression in
the Criterion row of the MatterClosed field in the query, I can type Yes in
the dialog box that comes up and I get all the Yes records. If I type No, I
get all the No records.

However, I would like to have the option to display all records come up. It
doesn't work to leave the dialog box blank, because if I don't type anything
in the dialog box I get all the No records, NOT all the records, the way I
want.

Is there a way to combine the above expression with the option to get all
records - or even without using the above expression, to have the option to
have either the Yes records, or the No records, or all the records.

KARL DEWEY said:
Can you explain what you are trying to do with some examples?

--
Build a little, test a little.


Owl said:
RonaldoOneNil gave me the very useful info of:

=IIF([Enter Yes or No]="Yes",True,False)

for a parameter query criterion (for a check box in a form).

I would like to know if I can enter Yes or No AND have the option for both.
Presumably it would be in the Or row, but I don't know what to enter.

Thanks for any help.
 
K

KARL DEWEY

Try this --
IIf([Enter Yes or No]="Yes",True,False) Or Like IIf([Enter Yes or No] Is
Null,"*",Null)


--
Build a little, test a little.


Owl said:
Thanks for your reply.

I have a form F00 based on a query Q00. In the form there is a field called
MatterClosed which is a Yes/No check box. If I put the above expression in
the Criterion row of the MatterClosed field in the query, I can type Yes in
the dialog box that comes up and I get all the Yes records. If I type No, I
get all the No records.

However, I would like to have the option to display all records come up. It
doesn't work to leave the dialog box blank, because if I don't type anything
in the dialog box I get all the No records, NOT all the records, the way I
want.

Is there a way to combine the above expression with the option to get all
records - or even without using the above expression, to have the option to
have either the Yes records, or the No records, or all the records.

KARL DEWEY said:
Can you explain what you are trying to do with some examples?

--
Build a little, test a little.


Owl said:
RonaldoOneNil gave me the very useful info of:

=IIF([Enter Yes or No]="Yes",True,False)

for a parameter query criterion (for a check box in a form).

I would like to know if I can enter Yes or No AND have the option for both.
Presumably it would be in the Or row, but I don't know what to enter.

Thanks for any help.
 
J

John Spencer

You could enter the criteria in a "box" under your yes/no field as

[Enter Yes or No]="Yes" Or [Enter Yes or No] Is Null

That will get reformatted by Access when it is saved.

In SQL view that would read something like

WHERE (YourField = [Enter Yes or No]="Yes" OR [Enter Yes or No] Is Null)

If the parameter is "Yes" then the first part of the expression evaluates to
YourField = True
If No, then
YourField=False
If blank (null) then
YourField = Null
and then the second part of the expression kicks in and gets evaluated as
Null is Null (therefore TRUE and therefore all the records are returned)

John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
 
J

javablood

I have been looking for the answer to this very question and what you
suggested works perfectly for me.

thanks,
--
javablood


KARL DEWEY said:
Try this --
IIf([Enter Yes or No]="Yes",True,False) Or Like IIf([Enter Yes or No] Is
Null,"*",Null)


--
Build a little, test a little.


Owl said:
Thanks for your reply.

I have a form F00 based on a query Q00. In the form there is a field called
MatterClosed which is a Yes/No check box. If I put the above expression in
the Criterion row of the MatterClosed field in the query, I can type Yes in
the dialog box that comes up and I get all the Yes records. If I type No, I
get all the No records.

However, I would like to have the option to display all records come up. It
doesn't work to leave the dialog box blank, because if I don't type anything
in the dialog box I get all the No records, NOT all the records, the way I
want.

Is there a way to combine the above expression with the option to get all
records - or even without using the above expression, to have the option to
have either the Yes records, or the No records, or all the records.

KARL DEWEY said:
Can you explain what you are trying to do with some examples?

--
Build a little, test a little.


:

RonaldoOneNil gave me the very useful info of:

=IIF([Enter Yes or No]="Yes",True,False)

for a parameter query criterion (for a check box in a form).

I would like to know if I can enter Yes or No AND have the option for both.
Presumably it would be in the Or row, but I don't know what to enter.

Thanks for any help.
 
O

Owl

Thank you, Karl. It worked perfectly. I am sorry I have only thanked you
now. I forgot to mark the Notify Me Of Replies box and have only just seen
this now.

KARL DEWEY said:
Try this --
IIf([Enter Yes or No]="Yes",True,False) Or Like IIf([Enter Yes or No] Is
Null,"*",Null)


--
Build a little, test a little.


Owl said:
Thanks for your reply.

I have a form F00 based on a query Q00. In the form there is a field called
MatterClosed which is a Yes/No check box. If I put the above expression in
the Criterion row of the MatterClosed field in the query, I can type Yes in
the dialog box that comes up and I get all the Yes records. If I type No, I
get all the No records.

However, I would like to have the option to display all records come up. It
doesn't work to leave the dialog box blank, because if I don't type anything
in the dialog box I get all the No records, NOT all the records, the way I
want.

Is there a way to combine the above expression with the option to get all
records - or even without using the above expression, to have the option to
have either the Yes records, or the No records, or all the records.

KARL DEWEY said:
Can you explain what you are trying to do with some examples?

--
Build a little, test a little.


:

RonaldoOneNil gave me the very useful info of:

=IIF([Enter Yes or No]="Yes",True,False)

for a parameter query criterion (for a check box in a form).

I would like to know if I can enter Yes or No AND have the option for both.
Presumably it would be in the Or row, but I don't know what to enter.

Thanks for any help.
 
O

Owl

Thank you for your response, John. However, it didn't work. I do have the
response of Karl's that does, but just thought you would probably like to
know anyway. Smiles. Sorry I am late with my thank you. Only saw it now.
Forgot to mark the Notify Me Of Replies box.

John Spencer said:
You could enter the criteria in a "box" under your yes/no field as

[Enter Yes or No]="Yes" Or [Enter Yes or No] Is Null

That will get reformatted by Access when it is saved.

In SQL view that would read something like

WHERE (YourField = [Enter Yes or No]="Yes" OR [Enter Yes or No] Is Null)

If the parameter is "Yes" then the first part of the expression evaluates to
YourField = True
If No, then
YourField=False
If blank (null) then
YourField = Null
and then the second part of the expression kicks in and gets evaluated as
Null is Null (therefore TRUE and therefore all the records are returned)

John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County

KARL said:
Try this --
IIf([Enter Yes or No]="Yes",True,False) Or Like IIf([Enter Yes or No] Is
Null,"*",Null)
.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top