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  

Return All Record if Check Box is Blank



 
 
Thread Tools Display Modes
  #1  
Old December 1st, 2009, 04:29 PM posted to microsoft.public.access.queries
yator
external usenet poster
 
Posts: 36
Default Return All Record if Check Box is Blank

How would I return a subset of records if a form check box is checked but
return all records if the check box is blank.

The formcheck box is: [Forms]![frm_switchboard]![chk_rndm]
The field [RandomMarker] can have the values of "Y" or Null only.

The following SQL pulls the correct data when the check box is checked, but
I recive an "OpenForm action was canceled" when the box is blank. How would I
modify the query to pull all results ([RandomMarker]="Y" or Null) when the
box is not checked?

SELECT tbl_tt_trans.TransNo, tbl_tt_trans.Fac, tbl_tt_trans.CODE,
tbl_tt_trans.RandomMarker, tbl_tt_trans.UseDT, tbl_tt_trans.TransNo
FROM tbl_tt_trans
WHERE (((tbl_tt_trans.CODE)=[Forms]![frm_switchboard]![swCode]) AND
((tbl_tt_trans.RandomMarker)=[Forms]![frm_switchboard]![chk_rndm]) AND
((tbl_tt_trans.PtType) Not Like "O"))
ORDER BY tbl_tt_trans.UseDT;

thanks for the help

  #2  
Old December 1st, 2009, 05:24 PM posted to microsoft.public.access.queries
John Spencer
external usenet poster
 
Posts: 7,815
Default Return All Record if Check Box is Blank

SELECT tbl_tt_trans.TransNo, tbl_tt_trans.Fac, tbl_tt_trans.CODE,
tbl_tt_trans.RandomMarker, tbl_tt_trans.UseDT, tbl_tt_trans.TransNo
FROM tbl_tt_trans

WHERE tbl_tt_trans.CODE)=[Forms]![frm_switchboard]![swCode]
AND
(tbl_tt_trans.RandomMarker=IIF([Forms]![frm_switchboard]![chk_rndm],"Y",Null)
OR [Forms]![frm_switchboard]![chk_rndm] = False)
AND tbl_tt_trans.PtType) "O"

ORDER BY tbl_tt_trans.UseDT;

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

yator wrote:
How would I return a subset of records if a form check box is checked but
return all records if the check box is blank.

The formcheck box is: [Forms]![frm_switchboard]![chk_rndm]
The field [RandomMarker] can have the values of "Y" or Null only.

The following SQL pulls the correct data when the check box is checked, but
I recive an "OpenForm action was canceled" when the box is blank. How would I
modify the query to pull all results ([RandomMarker]="Y" or Null) when the
box is not checked?

SELECT tbl_tt_trans.TransNo, tbl_tt_trans.Fac, tbl_tt_trans.CODE,
tbl_tt_trans.RandomMarker, tbl_tt_trans.UseDT, tbl_tt_trans.TransNo
FROM tbl_tt_trans
WHERE (((tbl_tt_trans.CODE)=[Forms]![frm_switchboard]![swCode]) AND
((tbl_tt_trans.RandomMarker)=[Forms]![frm_switchboard]![chk_rndm]) AND
((tbl_tt_trans.PtType) Not Like "O"))
ORDER BY tbl_tt_trans.UseDT;

thanks for the help

  #3  
Old December 1st, 2009, 05:24 PM posted to microsoft.public.access.queries
John Spencer
external usenet poster
 
Posts: 7,815
Default Return All Record if Check Box is Blank

SELECT tbl_tt_trans.TransNo, tbl_tt_trans.Fac, tbl_tt_trans.CODE,
tbl_tt_trans.RandomMarker, tbl_tt_trans.UseDT, tbl_tt_trans.TransNo
FROM tbl_tt_trans

WHERE tbl_tt_trans.CODE)=[Forms]![frm_switchboard]![swCode]
AND
(tbl_tt_trans.RandomMarker=IIF([Forms]![frm_switchboard]![chk_rndm],"Y",Null)
OR [Forms]![frm_switchboard]![chk_rndm] = False)
AND tbl_tt_trans.PtType) "O"

ORDER BY tbl_tt_trans.UseDT;

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

yator wrote:
How would I return a subset of records if a form check box is checked but
return all records if the check box is blank.

The formcheck box is: [Forms]![frm_switchboard]![chk_rndm]
The field [RandomMarker] can have the values of "Y" or Null only.

The following SQL pulls the correct data when the check box is checked, but
I recive an "OpenForm action was canceled" when the box is blank. How would I
modify the query to pull all results ([RandomMarker]="Y" or Null) when the
box is not checked?

SELECT tbl_tt_trans.TransNo, tbl_tt_trans.Fac, tbl_tt_trans.CODE,
tbl_tt_trans.RandomMarker, tbl_tt_trans.UseDT, tbl_tt_trans.TransNo
FROM tbl_tt_trans
WHERE (((tbl_tt_trans.CODE)=[Forms]![frm_switchboard]![swCode]) AND
((tbl_tt_trans.RandomMarker)=[Forms]![frm_switchboard]![chk_rndm]) AND
((tbl_tt_trans.PtType) Not Like "O"))
ORDER BY tbl_tt_trans.UseDT;

thanks for the help

  #4  
Old December 1st, 2009, 05:24 PM posted to microsoft.public.access.queries
John Spencer
external usenet poster
 
Posts: 7,815
Default Return All Record if Check Box is Blank

SELECT tbl_tt_trans.TransNo, tbl_tt_trans.Fac, tbl_tt_trans.CODE,
tbl_tt_trans.RandomMarker, tbl_tt_trans.UseDT, tbl_tt_trans.TransNo
FROM tbl_tt_trans

WHERE tbl_tt_trans.CODE)=[Forms]![frm_switchboard]![swCode]
AND
(tbl_tt_trans.RandomMarker=IIF([Forms]![frm_switchboard]![chk_rndm],"Y",Null)
OR [Forms]![frm_switchboard]![chk_rndm] = False)
AND tbl_tt_trans.PtType) "O"

ORDER BY tbl_tt_trans.UseDT;

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

yator wrote:
How would I return a subset of records if a form check box is checked but
return all records if the check box is blank.

The formcheck box is: [Forms]![frm_switchboard]![chk_rndm]
The field [RandomMarker] can have the values of "Y" or Null only.

The following SQL pulls the correct data when the check box is checked, but
I recive an "OpenForm action was canceled" when the box is blank. How would I
modify the query to pull all results ([RandomMarker]="Y" or Null) when the
box is not checked?

SELECT tbl_tt_trans.TransNo, tbl_tt_trans.Fac, tbl_tt_trans.CODE,
tbl_tt_trans.RandomMarker, tbl_tt_trans.UseDT, tbl_tt_trans.TransNo
FROM tbl_tt_trans
WHERE (((tbl_tt_trans.CODE)=[Forms]![frm_switchboard]![swCode]) AND
((tbl_tt_trans.RandomMarker)=[Forms]![frm_switchboard]![chk_rndm]) AND
((tbl_tt_trans.PtType) Not Like "O"))
ORDER BY tbl_tt_trans.UseDT;

thanks for the help

  #5  
Old December 1st, 2009, 10:06 PM posted to microsoft.public.access.queries
yator
external usenet poster
 
Posts: 36
Default Return All Record if Check Box is Blank

Thanks John. works great!

"John Spencer" wrote:

SELECT tbl_tt_trans.TransNo, tbl_tt_trans.Fac, tbl_tt_trans.CODE,
tbl_tt_trans.RandomMarker, tbl_tt_trans.UseDT, tbl_tt_trans.TransNo
FROM tbl_tt_trans

WHERE tbl_tt_trans.CODE)=[Forms]![frm_switchboard]![swCode]
AND
(tbl_tt_trans.RandomMarker=IIF([Forms]![frm_switchboard]![chk_rndm],"Y",Null)
OR [Forms]![frm_switchboard]![chk_rndm] = False)
AND tbl_tt_trans.PtType) "O"

ORDER BY tbl_tt_trans.UseDT;

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

yator wrote:
How would I return a subset of records if a form check box is checked but
return all records if the check box is blank.

The formcheck box is: [Forms]![frm_switchboard]![chk_rndm]
The field [RandomMarker] can have the values of "Y" or Null only.

The following SQL pulls the correct data when the check box is checked, but
I recive an "OpenForm action was canceled" when the box is blank. How would I
modify the query to pull all results ([RandomMarker]="Y" or Null) when the
box is not checked?

SELECT tbl_tt_trans.TransNo, tbl_tt_trans.Fac, tbl_tt_trans.CODE,
tbl_tt_trans.RandomMarker, tbl_tt_trans.UseDT, tbl_tt_trans.TransNo
FROM tbl_tt_trans
WHERE (((tbl_tt_trans.CODE)=[Forms]![frm_switchboard]![swCode]) AND
((tbl_tt_trans.RandomMarker)=[Forms]![frm_switchboard]![chk_rndm]) AND
((tbl_tt_trans.PtType) Not Like "O"))
ORDER BY tbl_tt_trans.UseDT;

thanks for the help

.

  #6  
Old December 1st, 2009, 10:06 PM posted to microsoft.public.access.queries
yator
external usenet poster
 
Posts: 36
Default Return All Record if Check Box is Blank

Thanks John. works great!

"John Spencer" wrote:

SELECT tbl_tt_trans.TransNo, tbl_tt_trans.Fac, tbl_tt_trans.CODE,
tbl_tt_trans.RandomMarker, tbl_tt_trans.UseDT, tbl_tt_trans.TransNo
FROM tbl_tt_trans

WHERE tbl_tt_trans.CODE)=[Forms]![frm_switchboard]![swCode]
AND
(tbl_tt_trans.RandomMarker=IIF([Forms]![frm_switchboard]![chk_rndm],"Y",Null)
OR [Forms]![frm_switchboard]![chk_rndm] = False)
AND tbl_tt_trans.PtType) "O"

ORDER BY tbl_tt_trans.UseDT;

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

yator wrote:
How would I return a subset of records if a form check box is checked but
return all records if the check box is blank.

The formcheck box is: [Forms]![frm_switchboard]![chk_rndm]
The field [RandomMarker] can have the values of "Y" or Null only.

The following SQL pulls the correct data when the check box is checked, but
I recive an "OpenForm action was canceled" when the box is blank. How would I
modify the query to pull all results ([RandomMarker]="Y" or Null) when the
box is not checked?

SELECT tbl_tt_trans.TransNo, tbl_tt_trans.Fac, tbl_tt_trans.CODE,
tbl_tt_trans.RandomMarker, tbl_tt_trans.UseDT, tbl_tt_trans.TransNo
FROM tbl_tt_trans
WHERE (((tbl_tt_trans.CODE)=[Forms]![frm_switchboard]![swCode]) AND
((tbl_tt_trans.RandomMarker)=[Forms]![frm_switchboard]![chk_rndm]) AND
((tbl_tt_trans.PtType) Not Like "O"))
ORDER BY tbl_tt_trans.UseDT;

thanks for the help

.

  #7  
Old December 1st, 2009, 10:06 PM posted to microsoft.public.access.queries
yator
external usenet poster
 
Posts: 36
Default Return All Record if Check Box is Blank

Thanks John. works great!

"John Spencer" wrote:

SELECT tbl_tt_trans.TransNo, tbl_tt_trans.Fac, tbl_tt_trans.CODE,
tbl_tt_trans.RandomMarker, tbl_tt_trans.UseDT, tbl_tt_trans.TransNo
FROM tbl_tt_trans

WHERE tbl_tt_trans.CODE)=[Forms]![frm_switchboard]![swCode]
AND
(tbl_tt_trans.RandomMarker=IIF([Forms]![frm_switchboard]![chk_rndm],"Y",Null)
OR [Forms]![frm_switchboard]![chk_rndm] = False)
AND tbl_tt_trans.PtType) "O"

ORDER BY tbl_tt_trans.UseDT;

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

yator wrote:
How would I return a subset of records if a form check box is checked but
return all records if the check box is blank.

The formcheck box is: [Forms]![frm_switchboard]![chk_rndm]
The field [RandomMarker] can have the values of "Y" or Null only.

The following SQL pulls the correct data when the check box is checked, but
I recive an "OpenForm action was canceled" when the box is blank. How would I
modify the query to pull all results ([RandomMarker]="Y" or Null) when the
box is not checked?

SELECT tbl_tt_trans.TransNo, tbl_tt_trans.Fac, tbl_tt_trans.CODE,
tbl_tt_trans.RandomMarker, tbl_tt_trans.UseDT, tbl_tt_trans.TransNo
FROM tbl_tt_trans
WHERE (((tbl_tt_trans.CODE)=[Forms]![frm_switchboard]![swCode]) AND
((tbl_tt_trans.RandomMarker)=[Forms]![frm_switchboard]![chk_rndm]) AND
((tbl_tt_trans.PtType) Not Like "O"))
ORDER BY tbl_tt_trans.UseDT;

thanks for the help

.

 




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 04:03 AM.


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