473,395 Members | 1,948 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,395 software developers and data experts.

Count specific records in subreport / DCount

Hi All,

I am new to Access and VBA and I am having trouble getting a count in a subreport.

I have a table named "companies" and a query named "clients" The clients are linked to our different companies. Both have a field named "country" which is linked to a table with all the existing countries.

I have created a report based on the "companies" table. The subreport is based is the "client" query and shows all clients for each company. So far so good.

In the report footer I want to create a count for all clients that are based in "Netherlands" and all clients that are not.

I tried: =DCount("[country]";"[client]";"[country] = 'Netherlands' ")
This doesn't work. This returns #error. I tried with brackets, without brackets, comma's etc, but all return the same.

I have also tried:
=Som(Abs([country]="Netherlands"))
and
=Som(IIf([country]="Netherlands";1;0))
these return the following message:

"This expression has a spelling error or is too complex for evaluation.
A numeric expression could contain to many complex elements.
Try to simplify the expression by assigning several parts to variables."

What am I doing wrong?
Mar 30 '15 #1
3 2123
It may be as simple as using SUM.
Mar 30 '15 #2
Thanks for the response. I tried:

=Sum(Abs([country]="Netherlands"))
and
=Sum(IIf([country]="Netherlands";1;0))

these return the following message:

"This expression has a spelling error or is too complex for evaluation.
A numeric expression could contain to many complex elements.
Try to simplify the expression by assigning several parts to variables."
Mar 31 '15 #3
nico5038
3,080 Expert 2GB
I would add a field in the query with '1' when Dutch and '0' when not, like you posted.
Expand|Select|Wrap|Line Numbers
  1. select ...., IIf([country]="Netherlands";1;0) as Nederlands, ... from ...
  2.  
Now the solution is to add the field in the group footer like:
=Sum([Nederlands])

Nic;o)
Apr 4 '15 #4

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

Similar topics

5
by: Terri | last post by:
I have a form with a multi-select combo. I dynamically build a SELECT statement, open a report, and set the recordsource to my dynamic SELECT statement. I count the records returned in the report...
6
by: RC | last post by:
My code below will loop through all the records in the table, and when the if statement is true it goes to the ***Me.ContainerNumberProductsTable = GETContainerNumber.Value*** bit like should but...
4
by: Stinky Pete | last post by:
Hi, In order to keep the file that's in development up to date with the reference (and still used) file, I need to regularly import the original main table and then physically select and append...
7
by: Killer42 | last post by:
Hi all. I dabble with Access, but haven't done anything in-depth for a number of years. What I want to do now is probably a fairly simple JOIN or something, but I just can't recall how to go about...
1
MrKorrel
by: MrKorrel | last post by:
I am uploading an issue log weekly into access. It's a list of numbered tickets from which I can derive which tickets are planned to go into our production system and when (which week of the year)...
16
by: mim77 | last post by:
Hi, I'm very rusty with Access programming. I hope someone can help me. I'm trying to include a count of the number of specific records in a field. Values for the records in the field are either...
1
by: sparks | last post by:
I have always just got a count on records and put up a box at the top of the entry forms saying something like 1 of 500 and updating it as you got to 500 of 500. I have never thought of this as...
1
by: Chetana | last post by:
Hi All, I want the query in sql which gives count of records for 2 conditions. Say i have table Category which has CategoryID and SubCatID as 2 columns. Then suppose i want count for the...
0
by: bbaamm | last post by:
Imports System.Data Imports System.Data.SqlClient Imports System.Data.OracleClient Imports CrystalDecisions.CrystalReports.Engine Imports CrystalDecisions.Shared Imports System.Globalization...
3
by: slenish | last post by:
Hello All, I am trying to use the DCount Function to count blank records on a table from a form. I want to make it so i can press a button and the function will run and show the total in a text...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...
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
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,...

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.