473,400 Members | 2,163 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,400 software developers and data experts.

Filter COUNTS in a report

147 100+
I have a report based on a query, in the report I have three columns

Column1
=Sum(Abs([qryMonthlyReport]![ClearanceCode] Like "*"))

Column2
=Sum(Abs([qryMonthlyReport]![ClearanceCode]="O"))

Column3
=Sum(Abs([qryMonthlyReport]![ClearanceCode]<>"O"))

My problem is I also want to limit the columns based on a date range in a form such as:
Between [Forms]![frmMonthlyReport]![Date1] And [Forms]![frmMonthlyReport]![Date2]

I just can't figure out the correct way I keep getting errors.
Thanks
Nov 27 '07 #1
11 1578
MMcCarthy
14,534 Expert Mod 8TB
Firstly, I'm not sure what you are using the Abs() function for here as it requires a number and your field seems to contain text. Also if you are referencing a field like this on a report you should have the field on the report as a control on its own. You can make it invisible if you do not wish to see it.
Nov 27 '07 #2
DAHMB
147 100+
Firstly, I'm not sure what you are using the Abs() function for here as it requires a number and your field seems to contain text. Also if you are referencing a field like this on a report you should have the field on the report as a control on its own. You can make it invisible if you do not wish to see it.
Ok but how do I do this based on the information I posted? What other information can I provide to help you help me?

Thanks
Nov 27 '07 #3
MMcCarthy
14,534 Expert Mod 8TB
Why are you using the Abs function. What are you trying to achieve?
Nov 27 '07 #4
DAHMB
147 100+
Why are you using the Abs function. What are you trying to achieve?
I am using it only because it has worked for me. I am new to this and found it as a suggestion online. I am tryint to count all the records in column1 based on the above example and then I am trying to count the records in colums 2 and 3 based on the above and to further filter them by two dates I list in a form that I use to call the report open, I want somethig like this for example:

Column2
=Sum(IIf(([qryMonthlyReport]![ClearanceCode]="O") And (TheDate Between [Forms]![frmMonthlyReport]![Date1] And [Forms]![frmMonthlyReport]![Date2],1,0)))

but this won't work and I don't know why, any ideas?

Thanks
Nov 27 '07 #5
MMcCarthy
14,534 Expert Mod 8TB
You had one of the closing brackets in the wrong place, try this ...

Column2
=Sum(IIf(([qryMonthlyReport]![ClearanceCode]="O") And ([TheDate] Between [Forms]![frmMonthlyReport]![Date1] And [Forms]![frmMonthlyReport]![Date2]),1,0))
Nov 27 '07 #6
Aha! The reason that Abs() works is that the bracketed expression evaluates to True or False, which in Access equals -1 or 0. So then Abs(True) = 1 and Abs(False) = 0 and when you Sum() that you get the right answer.
Nov 27 '07 #7
MMcCarthy
14,534 Expert Mod 8TB
Aha! The reason that Abs() works is that the bracketed expression evaluates to True or False, which in Access equals -1 or 0. So then Abs(True) = 1 and Abs(False) = 0 and when you Sum() that you get the right answer.
Nice one, I never thought of that :)
Nov 27 '07 #8
NeoPa
32,556 Expert Mod 16PB
Nice going Bill.
Starting to notch up some helpful answers I notice. Keep up the good work and welcome to theScripts :)
Nov 27 '07 #9
DAHMB
147 100+
YES!!! Thank you everyone that is it! I can't tell you how long I have been banging my head against the desk on this one.

Thanks
Dan
Nov 29 '07 #10
DAHMB
147 100+
Sorry one more question, why won't the below work?
Expand|Select|Wrap|Line Numbers
  1. =Sum(IIf(([qryMonthlyReport]![ClearanceCode]="O") And ([YearOpened]=[Forms]![frmMonthlyReport]![Year]),1,0))
Nov 29 '07 #11
DAHMB
147 100+
Disregard. I got it. Thanks anyway.
Nov 29 '07 #12

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

Similar topics

0
by: CSDunn | last post by:
Hello, I have a problem with field filtering between an Access 2000 Project form (the application is called CELDT), and the report that shows the results of the filter. Both the form and the...
3
by: Richard | last post by:
Hi, I have a form based on a table. When I filter the form I want to run a report based on the same table with the same filter as the form. No problem until I want to filter a combo box where...
8
by: dick | last post by:
I am just trying to print/report the results of a "filter by selection" which is done by right-clicking a form, filling in values, and "applying the filter." I have searched the newsgroups, and...
4
by: Nhmiller | last post by:
This is directly from Access' Help: "About designing a query When you open a query in Design view, or open a form, report, or datasheet and show the Advanced Filter/Sort window (Advanced...
6
by: Tony Miller | last post by:
All I have an aggregate query using the function Month & Year on a datereceived field ie: TheYear: Year() TheMonth: Month() These are the group by fields to give me a Count on another field by...
1
by: lorirobn | last post by:
Hi, I have a report that works just fine. Now I would like to add the capability to choose selection criteria to limit what is displayed. I created several reports that do this, but they used...
3
by: emgallagher | last post by:
I have a form which lists studies. People can filter the form based on details about the study, such as the study type. Currently users filter via the right click method. I would like to be...
1
by: Cara Murphy | last post by:
Hi There! Hoping you are able to help me with a filtering scenario: I have created a pop up form (Filter) to filter a report (Open Issues), which currently has a number of combo boxes which...
3
by: franc sutherland | last post by:
Hello, I have a report which I filter using the me.filter command in the OnOpen event. Me.Filter = "OrderID=" & Forms!variable_form_name! Me.FilterOn = True I want to be able to open that...
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:
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...
0
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...
0
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.