472,958 Members | 1,791 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,958 software developers and data experts.

Query/Report Behavior?

I have a query based report where a number of the fields in each record
are Yes/No data fields.

I would like this report to behave as follows:

If ALL of the Yes/No data fields in a given record have a value of YES,
I would like that particular record to be suppressed (I.e. NOT appear in
the report).

and

If ANY of the Yes/No data fields in a given record have a value of NO, I
would like that particular record to appear in the report.

How can this be done?
Nov 12 '05 #1
3 1458
Todd, the structure you describe usually represents something that has not
been normalized properly, i.e. you should create a related table with a
record for each choice that does apply instead of heaps of check boxes in
one record.

To work around this structure, you could use the fact that Access uses -1 of
True and 0 for False. Therefore summing the fields gives you a count of how
many are checked. Type the expression into the Field row of query design:
HowMany: Abs([Field1] + [Field2] + [Field3])
Then in the Criteria row, ask for fewer than the total number of boxes you
have:
< 3
--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Todd D. Levy" <us**************@spamex.com> wrote in message
news:MP************************@nyc.news.speakeasy .net...
I have a query based report where a number of the fields in each record
are Yes/No data fields.

I would like this report to behave as follows:

If ALL of the Yes/No data fields in a given record have a value of YES,
I would like that particular record to be suppressed (I.e. NOT appear in
the report).

and

If ANY of the Yes/No data fields in a given record have a value of NO, I
would like that particular record to appear in the report.

How can this be done?

Nov 12 '05 #2
Allen,

Thanks for the help; I am going to use your work around solution because
changes to the structure of the database are not possible at this time.

One question: does using Abs in the field row of the query treat the -1
for Yes/True as 1 so that the sum of 3 fields is 3 and not -3?

I would like to do one other thing for this report:

On the report itself I would like a Yes/No field with a Yes value to be
displayed with GREEN text, and a Yes/No field with a NO value to be
displayed with RED text.

I assume this is done with VBA code; does it have to be done on a field
by field basis individually, or is it possible to address this issue for
all Yes/No fields with a single block of code?

In article <40***********************@freenews.iinet.net.au >,
Al*********@SeeSig.Invalid says...
Todd, the structure you describe usually represents something that has not
been normalized properly, i.e. you should create a related table with a
record for each choice that does apply instead of heaps of check boxes in
one record.

To work around this structure, you could use the fact that Access uses -1 of
True and 0 for False. Therefore summing the fields gives you a count of how
many are checked. Type the expression into the Field row of query design:
HowMany: Abs([Field1] + [Field2] + [Field3])
Then in the Criteria row, ask for fewer than the total number of boxes you
have:
< 3

Nov 12 '05 #3
Yes Abs() drops the sign, returning the absolute value.

If you represent the control with a text box on your report, you could use
Conditional Formatting to set its BackColor. In report design view, select
the text box, and choose Conditional Formatting from the Format menu.

Conditional Formatting is not available in Access 97 and older, but you can
still include the color in the Format property of the text box.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Todd D. Levy" <us**************@spamex.com> wrote in message
news:MP************************@nyc.news.speakeasy .net...

Thanks for the help; I am going to use your work around solution because
changes to the structure of the database are not possible at this time.

One question: does using Abs in the field row of the query treat the -1
for Yes/True as 1 so that the sum of 3 fields is 3 and not -3?

I would like to do one other thing for this report:

On the report itself I would like a Yes/No field with a Yes value to be
displayed with GREEN text, and a Yes/No field with a NO value to be
displayed with RED text.

I assume this is done with VBA code; does it have to be done on a field
by field basis individually, or is it possible to address this issue for
all Yes/No fields with a single block of code?

In article <40***********************@freenews.iinet.net.au >,
Al*********@SeeSig.Invalid says...
Todd, the structure you describe usually represents something that has not been normalized properly, i.e. you should create a related table with a
record for each choice that does apply instead of heaps of check boxes in one record.

To work around this structure, you could use the fact that Access uses -1 of True and 0 for False. Therefore summing the fields gives you a count of how many are checked. Type the expression into the Field row of query design: HowMany: Abs([Field1] + [Field2] + [Field3])
Then in the Criteria row, ask for fewer than the total number of boxes you have:
< 3

Nov 12 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

22
by: Robert Brown | last post by:
suppose I have the following table: CREATE TABLE (int level, color varchar, length int, width int, height int) It has the following rows 1, "RED", 8, 10, 12 2, NULL, NULL, NULL, 20...
1
by: Mark | last post by:
Hi - I tried this in VS.Net, and also in the Web Matrix code below: - but I am getting a type mismatch error. The sql statement runs perfectly from within the Access Query Designer. Can anyone...
6
by: Steven D.Arnold | last post by:
I have a query which does not use column indexes that it should use. I have discovered some interesting behaviors of Postgres which may indicate a bug in the database's query planning. Take a...
2
by: carl.barrett | last post by:
Hi, I'm back with the same question as I still can't get it to display my data the way I want it to. The table lists information about a perpetrator involved with an anti social behaviour...
2
by: matt | last post by:
hello, i have an .RPT file that i am using to load a report via the ASP.NET CrystalReportViewer control. i dont include my .RPTs as embedded resources...instead i load the absolute path of the...
4
by: lorirobn | last post by:
Hi, I have a report displaying items that are missing from a room. I created 2 queries, the first getting the items IN the room, and the second being an "unmatched" query that references the...
6
by: Phil Stanton | last post by:
I am running a query that calls a function used to format addresses depending on the width of a control on a report that shows that address. The same query is used as the RecordSource of lots of...
3
dlite922
by: dlite922 | last post by:
I'm building a dynamic reporting system. The report can of course query multiple tables. The query declares which tables it will access, the fields that it needs for display, and the dependent...
10
by: teddysnips | last post by:
My clients have asked me to maintain a database that was developed in- house. It's pretty good, considering the developer isn't a "programmer". The first thing they want me to do is to split it...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
2
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.