473,408 Members | 1,683 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Check Boxes + Sort by Condition in Access Report

3
Hello Everyone: I am hoping one of the gurus here will give me some help.
I have designed a form with some check boxes. I put the checkboxes there on the form so later I could use them as flags on separate reports. Just to answer a few questions, yes, the subform is properly tied to the main form and they are all bound controls...been there, done that. Now, the purpose of a check box, as I see it is to have two logical conditions (checked = logical 1 and unchecked = logical 0 ... either it is checked or it isn't. Theoretically to me, that means, I could set up a logic condition in a query which says, "querry only the information from the main form or subform which has one or the other condition)...then, build a report based on the query which will print out or show only the recordset which meets the criteria. In other words, I should be able to build a logic statement or SQL statement in the query which says, only get the information from the records which contain Checkbox1 = 0 (or Checkbox1 =1)...
without the OR condition of course.

The only problem with this is, I have been unable to get the query to do that.
Microsoft HELP is dumb on this issue. The logical 0 or 1 is the same thing as a logical Y or N based on Y/N. Yet, I cannot find anything that tells me how to build the SQL statement or logic statement in the query that successfully pools together only th data from the db that meets the logic criteria.

When I try to do this in a report, my fields come up blank and I have a single greyed out check box on the report. I have gone back to look at the properties of the checkboxes to see if there is any way I could build the expression from that vantage point, but there are no properties that I understand that directly do this.

So to condense what I have said, I have checkboxes on my subform which is tied to a form (yes, the field names and conditions are identical for both underlying tables), I want to end up with a report (query or not), which pprints out only the dataset which meets the logic condition of Y or N (0 or 1).

Can someone help me with the code or method to do this? Thank you everyone.

Jimc52
Nov 17 '06 #1
5 7360
MMcCarthy
14,534 Expert Mod 8TB
Hello Everyone: I am hoping one of the gurus here will give me some help.
I have designed a form with some check boxes. I put the checkboxes there on the form so later I could use them as flags on separate reports. Just to answer a few questions, yes, the subform is properly tied to the main form and they are all bound controls...been there, done that. Now, the purpose of a check box, as I see it is to have two logical conditions (checked = logical 1 and unchecked = logical 0 ... either it is checked or it isn't. Theoretically to me, that means, I could set up a logic condition in a query which says, "querry only the information from the main form or subform which has one or the other condition)...then, build a report based on the query which will print out or show only the recordset which meets the criteria. In other words, I should be able to build a logic statement or SQL statement in the query which says, only get the information from the records which contain Checkbox1 = 0 (or Checkbox1 =1)...
without the OR condition of course.

The only problem with this is, I have been unable to get the query to do that.
Microsoft HELP is dumb on this issue. The logical 0 or 1 is the same thing as a logical Y or N based on Y/N. Yet, I cannot find anything that tells me how to build the SQL statement or logic statement in the query that successfully pools together only th data from the db that meets the logic criteria.
Solution: In Access the logical state for true is -1 not 1.

Note: There are actually three states for a checkbox (Checked) -1, (Unchecked) 0 and (Unselected) 1.

You shouldn't come up against this problem with individual checkboxes because access defaults to 0 but look out for it in option groups.


When I try to do this in a report, my fields come up blank and I have a single greyed out check box on the report.
The aforementioned unselected state.
Nov 18 '06 #2
jimc52
3
McCarthy: Incredible! Just incredible. I NEVER would have guessed that Microsoft would bastardize simple logic algebra like that. Although the idea is ingenious, taking into account the negative 1 as a third conditional state, it defied my logic. I programmed for years in a number of languages and I didn't run into something quite like this. Access is a different kind of animal, even in it's logic elements.

I want to thank you for telling me the correct logic states. I won't be able to check this out until Monday at work, but I sure am going to give it a try.

I would like to ask you one further question, if you can answer it. In my query, under Condition, what would you recommend being the conditional logic statement? All I can find so far is using the IiF conditional statement using the field name such as IiF("One_Is", -1) In other words, if my checkbox is TRUE (Yes Conditon) then filter for all records in the record set which meet this condition. I am not sure that I have written this correctly since I normally don't use SQL statements to do things. Do you have a recommendation?

Thanks again.
Jimc52
Nov 18 '06 #3
MMcCarthy
14,534 Expert Mod 8TB
Jimc52,

Can you post the relevant sql of your query as it stands at the moment. Don't worry if it's not working it will just help me to understand what you need from the logic.

Mary


McCarthy: Incredible! Just incredible. I NEVER would have guessed that Microsoft would bastardize simple logic algebra like that. Although the idea is ingenious, taking into account the negative 1 as a third conditional state, it defied my logic. I programmed for years in a number of languages and I didn't run into something quite like this. Access is a different kind of animal, even in it's logic elements.

I want to thank you for telling me the correct logic states. I won't be able to check this out until Monday at work, but I sure am going to give it a try.

I would like to ask you one further question, if you can answer it. In my query, under Condition, what would you recommend being the conditional logic statement? All I can find so far is using the IiF conditional statement using the field name such as IiF("One_Is", -1) In other words, if my checkbox is TRUE (Yes Conditon) then filter for all records in the record set which meet this condition. I am not sure that I have written this correctly since I normally don't use SQL statements to do things. Do you have a recommendation?

Thanks again.
Jimc52
Nov 18 '06 #4
PEB
1,418 Expert 1GB
The construction of IIF is

IIF(Len("One_Is")>1, True, False)

In function of your regional Settings it can be also:

IIF(Len("One_Is")>1; True; False)
Nov 18 '06 #5
NeoPa
32,556 Expert Mod 16PB
The negative 1 is not the extra here (that is the 1).
Logically -1 is used because it represents 1s in all bit positions and is quite standard.
MS invented the unset state (I think) which can actually be very handy.
I'm pretty sure, though, that controls that can hold boolean values have a property which allows / disallows the new value.
You should be able to disable this mode on your controls to give what you expected.

True / False :
Any non-zero value is treated as True in VBA. This does not mean that it is treated as =True!
When writing code it is sometimes important to check :
(YourValue) and NOT (YourValue)=True.
Nov 18 '06 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

17
by: Dave Smithz | last post by:
Hi there, A PHP application I built has a section which lists a number of members to a club whose names each appear with a check box beside them that can be ticked. These check boxes are part...
4
by: Brian | last post by:
I'm pulling what's left of my hair out. I'm trying to check a memo field on opening a report. If the field has "value", I'd like to change the fields back color. If it's "Empty", I'd like to...
1
by: James | last post by:
I am creating a system whereby equipment is inspected. Data is inputted into an inspection form. However, any equipment that is not satisfactory needs to have spare parts ordered for that piece of...
4
by: Jared | last post by:
Radio Button or Check Box and Event Procedures I need to insert either radio buttons or check boxes onto my form. I'm not sure which to use, or if there are other options. I am using the buttons...
1
by: Jim in Arizona | last post by:
I'm having dificulty figuring out how to process multiple check boxes on a web form. Let's say I have three check boxes: cbox1 cbox2 cbox3 The only way I can think of to code the...
4
by: cdub100 | last post by:
Access 2003 Windows XP I have a form containing contact information along with 6 check boxes. I want to be able to run a report with just the entries with certain boxes checked. Example: I...
2
by: vibee | last post by:
this might be a simple question but how do i assign values to a check box in a query condition, i have the following so far: Required: IIf(="existing",True,False) The problem is the check boxes...
5
by: Andrew Meador | last post by:
I have a form (Change Card List by Status) with a check box (cboNOT) and a list box (lstStatus). There is an Open Report button that opens a report (Report - Change Card List) which uses a query...
1
by: eclipse93081 | last post by:
I need a way to sum check boxes in Access. On the database interface I have 3 boxes you can check; "Scheduled/Went On", "Scheduled/Did Not Go On", and "Not Scheduled". I have the boxes set up as...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.