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  

Criteria based on checkbox



 
 
Thread Tools Display Modes
  #1  
Old November 30th, 2009, 09:20 PM posted to microsoft.public.access.queries
Paul Washburn[_2_]
external usenet poster
 
Posts: 31
Default Criteria based on checkbox

Im trying to create a query that will return all results, but will apply
filters based on a checkbox. I found the code below from a previous
question, but this returns zero records if the box is unchecked.

Thanks for any help.


[code]
[Forms]![FormRpt]![chkEdi] Or [Forms]![FormRpt]![chkEdi]=False
[code]
  #2  
Old November 30th, 2009, 11:38 PM posted to microsoft.public.access.queries
Crystal (strive4peace)[_2_]
external usenet poster
 
Posts: 53
Default Criteria based on checkbox

Hi Paul,

your criteria is checking for True and for False ... but
what if the checkbox is null?

this will look at the checkbox for a value and if it is
null, it will assume it is false:

nz([Forms]![FormRpt]![chkEdi],false)

to work, FormRpt must be open

Warm Regards,
Crystal
remote programming and training
http://MSAccessGurus.com

free video tutorials
http://www.YouTube.com/user/LearnAccessByCrystal

Access Basics
http://www.AccessMVP.com/strive4peace
free 100-page book that covers essentials in Access

*
(: have an awesome day
*


Paul Washburn wrote:
Im trying to create a query that will return all results, but will apply
filters based on a checkbox. I found the code below from a previous
question, but this returns zero records if the box is unchecked.

Thanks for any help.


[code]
[Forms]![FormRpt]![chkEdi] Or [Forms]![FormRpt]![chkEdi]=False
[code]

  #3  
Old December 1st, 2009, 03:02 PM posted to microsoft.public.access.queries
Paul Washburn[_2_]
external usenet poster
 
Posts: 31
Default Criteria based on checkbox

Thanks,

Not quite what im looking for though. I need the report to show all records
if nothing is checked. You example showed all records where the box was
unchecked.

I found that flipping my orignal code gave me the results i was looking for.
IE: Displayed all records when unchecked and only the pertaining records
when checked.

Code:
([Forms]![FormRpt]![chkEdi]=False) Or [Forms]![FormRpt]![chkEdi]
"Crystal (strive4peace)" wrote:

Hi Paul,

your criteria is checking for True and for False ... but
what if the checkbox is null?

this will look at the checkbox for a value and if it is
null, it will assume it is false:

nz([Forms]![FormRpt]![chkEdi],false)

to work, FormRpt must be open

Warm Regards,
Crystal
remote programming and training
http://MSAccessGurus.com

free video tutorials
http://www.YouTube.com/user/LearnAccessByCrystal

Access Basics
http://www.AccessMVP.com/strive4peace
free 100-page book that covers essentials in Access

*
(: have an awesome day
*


Paul Washburn wrote:
Im trying to create a query that will return all results, but will apply
filters based on a checkbox. I found the code below from a previous
question, but this returns zero records if the box is unchecked.

Thanks for any help.


[code]
[Forms]![FormRpt]![chkEdi] Or [Forms]![FormRpt]![chkEdi]=False
[code]

.

  #4  
Old December 1st, 2009, 03:02 PM posted to microsoft.public.access.queries
Paul Washburn[_2_]
external usenet poster
 
Posts: 31
Default Criteria based on checkbox

Thanks,

Not quite what im looking for though. I need the report to show all records
if nothing is checked. You example showed all records where the box was
unchecked.

I found that flipping my orignal code gave me the results i was looking for.
IE: Displayed all records when unchecked and only the pertaining records
when checked.

Code:
([Forms]![FormRpt]![chkEdi]=False) Or [Forms]![FormRpt]![chkEdi]
"Crystal (strive4peace)" wrote:

Hi Paul,

your criteria is checking for True and for False ... but
what if the checkbox is null?

this will look at the checkbox for a value and if it is
null, it will assume it is false:

nz([Forms]![FormRpt]![chkEdi],false)

to work, FormRpt must be open

Warm Regards,
Crystal
remote programming and training
http://MSAccessGurus.com

free video tutorials
http://www.YouTube.com/user/LearnAccessByCrystal

Access Basics
http://www.AccessMVP.com/strive4peace
free 100-page book that covers essentials in Access

*
(: have an awesome day
*


Paul Washburn wrote:
Im trying to create a query that will return all results, but will apply
filters based on a checkbox. I found the code below from a previous
question, but this returns zero records if the box is unchecked.

Thanks for any help.


[code]
[Forms]![FormRpt]![chkEdi] Or [Forms]![FormRpt]![chkEdi]=False
[code]

.

  #5  
Old December 1st, 2009, 03:02 PM posted to microsoft.public.access.queries
Paul Washburn[_2_]
external usenet poster
 
Posts: 31
Default Criteria based on checkbox

Thanks,

Not quite what im looking for though. I need the report to show all records
if nothing is checked. You example showed all records where the box was
unchecked.

I found that flipping my orignal code gave me the results i was looking for.
IE: Displayed all records when unchecked and only the pertaining records
when checked.

Code:
([Forms]![FormRpt]![chkEdi]=False) Or [Forms]![FormRpt]![chkEdi]
"Crystal (strive4peace)" wrote:

Hi Paul,

your criteria is checking for True and for False ... but
what if the checkbox is null?

this will look at the checkbox for a value and if it is
null, it will assume it is false:

nz([Forms]![FormRpt]![chkEdi],false)

to work, FormRpt must be open

Warm Regards,
Crystal
remote programming and training
http://MSAccessGurus.com

free video tutorials
http://www.YouTube.com/user/LearnAccessByCrystal

Access Basics
http://www.AccessMVP.com/strive4peace
free 100-page book that covers essentials in Access

*
(: have an awesome day
*


Paul Washburn wrote:
Im trying to create a query that will return all results, but will apply
filters based on a checkbox. I found the code below from a previous
question, but this returns zero records if the box is unchecked.

Thanks for any help.


[code]
[Forms]![FormRpt]![chkEdi] Or [Forms]![FormRpt]![chkEdi]=False
[code]

.

  #6  
Old December 1st, 2009, 03:13 PM posted to microsoft.public.access.queries
Paul Washburn[_2_]
external usenet poster
 
Posts: 31
Default Criteria based on checkbox

Code:
([Forms]![FormRpt]![chkEdi]=False) Or [Forms]![FormRpt]![chkEdi]
Update:

The code above is working very sparadically. Ill run it once and get
nothing, run it again and get all results, run it a third time and get the
correct results. In the background the criteria is getting moved around,
added as new fields, and duplicated throughout the criteria.

Any help would be appreciated.

Thank you.

"Paul Washburn" wrote:

Thanks,

Not quite what im looking for though. I need the report to show all records
if nothing is checked. You example showed all records where the box was
unchecked.

I found that flipping my orignal code gave me the results i was looking for.
IE: Displayed all records when unchecked and only the pertaining records
when checked.

Code:
 ([Forms]![FormRpt]![chkEdi]=False) Or [Forms]![FormRpt]![chkEdi]

"Crystal (strive4peace)" wrote:

Hi Paul,

your criteria is checking for True and for False ... but
what if the checkbox is null?

this will look at the checkbox for a value and if it is
null, it will assume it is false:

nz([Forms]![FormRpt]![chkEdi],false)

to work, FormRpt must be open

Warm Regards,
Crystal
remote programming and training
http://MSAccessGurus.com

free video tutorials
http://www.YouTube.com/user/LearnAccessByCrystal

Access Basics
http://www.AccessMVP.com/strive4peace
free 100-page book that covers essentials in Access

*
(: have an awesome day
*


Paul Washburn wrote:
Im trying to create a query that will return all results, but will apply
filters based on a checkbox. I found the code below from a previous
question, but this returns zero records if the box is unchecked.

Thanks for any help.


[code]
[Forms]![FormRpt]![chkEdi] Or [Forms]![FormRpt]![chkEdi]=False
[code]

.

  #7  
Old December 1st, 2009, 03:13 PM posted to microsoft.public.access.queries
Paul Washburn[_2_]
external usenet poster
 
Posts: 31
Default Criteria based on checkbox

Code:
([Forms]![FormRpt]![chkEdi]=False) Or [Forms]![FormRpt]![chkEdi]
Update:

The code above is working very sparadically. Ill run it once and get
nothing, run it again and get all results, run it a third time and get the
correct results. In the background the criteria is getting moved around,
added as new fields, and duplicated throughout the criteria.

Any help would be appreciated.

Thank you.

"Paul Washburn" wrote:

Thanks,

Not quite what im looking for though. I need the report to show all records
if nothing is checked. You example showed all records where the box was
unchecked.

I found that flipping my orignal code gave me the results i was looking for.
IE: Displayed all records when unchecked and only the pertaining records
when checked.

Code:
 ([Forms]![FormRpt]![chkEdi]=False) Or [Forms]![FormRpt]![chkEdi]

"Crystal (strive4peace)" wrote:

Hi Paul,

your criteria is checking for True and for False ... but
what if the checkbox is null?

this will look at the checkbox for a value and if it is
null, it will assume it is false:

nz([Forms]![FormRpt]![chkEdi],false)

to work, FormRpt must be open

Warm Regards,
Crystal
remote programming and training
http://MSAccessGurus.com

free video tutorials
http://www.YouTube.com/user/LearnAccessByCrystal

Access Basics
http://www.AccessMVP.com/strive4peace
free 100-page book that covers essentials in Access

*
(: have an awesome day
*


Paul Washburn wrote:
Im trying to create a query that will return all results, but will apply
filters based on a checkbox. I found the code below from a previous
question, but this returns zero records if the box is unchecked.

Thanks for any help.


[code]
[Forms]![FormRpt]![chkEdi] Or [Forms]![FormRpt]![chkEdi]=False
[code]

.

  #8  
Old December 1st, 2009, 03:13 PM posted to microsoft.public.access.queries
Paul Washburn[_2_]
external usenet poster
 
Posts: 31
Default Criteria based on checkbox

Code:
([Forms]![FormRpt]![chkEdi]=False) Or [Forms]![FormRpt]![chkEdi]
Update:

The code above is working very sparadically. Ill run it once and get
nothing, run it again and get all results, run it a third time and get the
correct results. In the background the criteria is getting moved around,
added as new fields, and duplicated throughout the criteria.

Any help would be appreciated.

Thank you.

"Paul Washburn" wrote:

Thanks,

Not quite what im looking for though. I need the report to show all records
if nothing is checked. You example showed all records where the box was
unchecked.

I found that flipping my orignal code gave me the results i was looking for.
IE: Displayed all records when unchecked and only the pertaining records
when checked.

Code:
 ([Forms]![FormRpt]![chkEdi]=False) Or [Forms]![FormRpt]![chkEdi]

"Crystal (strive4peace)" wrote:

Hi Paul,

your criteria is checking for True and for False ... but
what if the checkbox is null?

this will look at the checkbox for a value and if it is
null, it will assume it is false:

nz([Forms]![FormRpt]![chkEdi],false)

to work, FormRpt must be open

Warm Regards,
Crystal
remote programming and training
http://MSAccessGurus.com

free video tutorials
http://www.YouTube.com/user/LearnAccessByCrystal

Access Basics
http://www.AccessMVP.com/strive4peace
free 100-page book that covers essentials in Access

*
(: have an awesome day
*


Paul Washburn wrote:
Im trying to create a query that will return all results, but will apply
filters based on a checkbox. I found the code below from a previous
question, but this returns zero records if the box is unchecked.

Thanks for any help.


[code]
[Forms]![FormRpt]![chkEdi] Or [Forms]![FormRpt]![chkEdi]=False
[code]

.

  #9  
Old December 1st, 2009, 05:11 PM posted to microsoft.public.access.queries
John W. Vinson
external usenet poster
 
Posts: 18,261
Default Criteria based on checkbox

On Tue, 1 Dec 2009 07:13:02 -0800, Paul Washburn
wrote:

Code:
([Forms]![FormRpt]![chkEdi]=False) Or [Forms]![FormRpt]![chkEdi]

Update:

The code above is working very sparadically. Ill run it once and get
nothing, run it again and get all results, run it a third time and get the
correct results. In the background the criteria is getting moved around,
added as new fields, and duplicated throughout the criteria.


Please post the *complete* SQL view of the query.

As written it appears that this criterion will return the record if chkEDI is
False or if it is True - i.e. I'd expect it to return all records. I'm sure
that's not the case, so there's something else going on in the query!
--

John W. Vinson [MVP]
  #10  
Old December 1st, 2009, 05:11 PM posted to microsoft.public.access.queries
John W. Vinson
external usenet poster
 
Posts: 18,261
Default Criteria based on checkbox

On Tue, 1 Dec 2009 07:13:02 -0800, Paul Washburn
wrote:

Code:
([Forms]![FormRpt]![chkEdi]=False) Or [Forms]![FormRpt]![chkEdi]

Update:

The code above is working very sparadically. Ill run it once and get
nothing, run it again and get all results, run it a third time and get the
correct results. In the background the criteria is getting moved around,
added as new fields, and duplicated throughout the criteria.


Please post the *complete* SQL view of the query.

As written it appears that this criterion will return the record if chkEDI is
False or if it is True - i.e. I'd expect it to return all records. I'm sure
that's not the case, so there's something else going on in the query!
--

John W. Vinson [MVP]
 




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:44 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.