473,569 Members | 2,762 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Check Boxes + Sort by Condition in Access Report

3 New Member
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)...th en, 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 7400
MMcCarthy
14,534 Recognized Expert Moderator MVP
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)...th en, 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 New Member
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 Recognized Expert Moderator MVP
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 Recognized Expert Top Contributor
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,564 Recognized Expert Moderator MVP
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)=Tru e.
Nov 18 '06 #6

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

Similar topics

17
2746
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 of a form which amongst other submit buttons has a one particular submit button that if checked will send the form data (using GET) to a script...
4
12100
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 leave it white. (i.e. if their is data in the memo field, I want it highlighted in yellow.) I've tried isnull, isempty, ="", all with no luck. I'd...
1
2252
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 equipment from a list of parts. I kind of need a form which lists parts and then check boxes next to a part can be created so the user can select...
4
11025
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 to: if one is clicked, its corresponding information will become available on another document, if it's not clicked no information will be...
1
3092
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 possibilities is something like:
4
1882
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 have check boxes A - F I want to run a report on all the contacts that have box A checked. I'd also like to be able to run a report on all the...
2
1755
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 dissappear in the query in data sheet view, and is replaced with 1's and 0's when i want the check boxes to have check marks. Thanks to anyone who...
5
6724
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 (SQL -Change Card List). What I want to do is have the form open the report where a filter is set to use the values from the check box AND the...
1
9172
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 "True/False" in design view so on my report it will assign either a 1 if true, or a 0 if false. I need a way to sum each category by itself so I can...
0
7694
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7921
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8118
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7666
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7964
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6278
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5217
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
1
2107
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
936
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.