473,385 Members | 1,830 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,385 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 2122
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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...

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.