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
11 1578
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.
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
Why are you using the Abs function. What are you trying to achieve?
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
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))
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.
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 :)
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 :)
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
Sorry one more question, why won't the below work? - =Sum(IIf(([qryMonthlyReport]![ClearanceCode]="O") And ([YearOpened]=[Forms]![frmMonthlyReport]![Year]),1,0))
Disregard. I got it. Thanks anyway.
Sign in to post your reply or Sign up for a free account.
Similar topics
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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...
|
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,...
|
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: 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...
|
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,...
|
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...
| |