A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Yes/No parameter for Yes or No or Both



 
 
Thread Tools Display Modes
  #1  
Old November 19th, 2009, 07:16 PM posted to microsoft.public.access.queries
owl
external usenet poster
 
Posts: 128
Default Yes/No parameter for Yes or No or Both

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.


  #2  
Old November 19th, 2009, 07:29 PM posted to microsoft.public.access.queries
KARL DEWEY
external usenet poster
 
Posts: 10,767
Default Yes/No parameter for Yes or No or Both

Can you explain what you are trying to do with some examples?

--
Build a little, test a little.


"Owl" wrote:

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.


  #3  
Old November 19th, 2009, 10:44 PM posted to microsoft.public.access.queries
owl
external usenet poster
 
Posts: 128
Default Yes/No parameter for Yes or No or Both

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" wrote:

Can you explain what you are trying to do with some examples?

--
Build a little, test a little.


"Owl" wrote:

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.


  #4  
Old November 19th, 2009, 11:52 PM posted to microsoft.public.access.queries
KARL DEWEY
external usenet poster
 
Posts: 10,767
Default Yes/No parameter for Yes or No or Both

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" wrote:

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" wrote:

Can you explain what you are trying to do with some examples?

--
Build a little, test a little.


"Owl" wrote:

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.


  #5  
Old November 20th, 2009, 01:54 PM posted to microsoft.public.access.queries
John Spencer
external usenet poster
 
Posts: 7,815
Default Yes/No parameter for Yes or No or Both

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 DEWEY wrote:
Try this --
IIf([Enter Yes or No]="Yes",True,False) Or Like IIf([Enter Yes or No] Is
Null,"*",Null)


  #6  
Old December 15th, 2009, 02:11 PM posted to microsoft.public.access.queries
javablood
external usenet poster
 
Posts: 84
Default Yes/No parameter for Yes or No or Both

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

thanks,
--
javablood


"KARL DEWEY" wrote:

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" wrote:

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" wrote:

Can you explain what you are trying to do with some examples?

--
Build a little, test a little.


"Owl" wrote:

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.


  #7  
Old February 26th, 2010, 01:17 PM posted to microsoft.public.access.queries
owl
external usenet poster
 
Posts: 128
Default Yes/No parameter for Yes or No or Both

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" wrote:

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" wrote:

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" wrote:

Can you explain what you are trying to do with some examples?

--
Build a little, test a little.


"Owl" wrote:

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.


  #8  
Old February 26th, 2010, 01:19 PM posted to microsoft.public.access.queries
owl
external usenet poster
 
Posts: 128
Default Yes/No parameter for Yes or No or Both

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" wrote:

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 DEWEY wrote:
Try this --
IIf([Enter Yes or No]="Yes",True,False) Or Like IIf([Enter Yes or No] Is
Null,"*",Null)


.

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 09:39 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.