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

record counts with specific records

7
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, 2, 3, or 4. I just can't seem to come up with the right statement for a report that will give me the number of records with, for example, 1 as the value.
Any ideas?
Thanks!
Jun 3 '07 #1
16 2396
JConsulting
603 Expert 512MB
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, 2, 3, or 4. I just can't seem to come up with the right statement for a report that will give me the number of records with, for example, 1 as the value.
Any ideas?
Thanks!
if you're assigning it to a field,

how about something like

=count(iif([range1]=1,1,0)
Jun 3 '07 #2
mim77
7
if you're assigning it to a field,

how about something like

=count(iif([range1]=1,1,0)

Hi,

Thanks for the idea.
Assuming [range1] is the name of the field in the table, when I use this, I get a prompt to enter parameters. What I really need is a form that provides info that looks like this:

# of records where Overall Performance = 1
# of records where Overall Performance = 2
# of records where Overall Performance =3
# of Records where Overall Performance =4

The Overall Performance data is all stored in one field in a table.
Jun 4 '07 #3
MMcCarthy
14,534 Expert Mod 8TB
Try putting textboxes on the form. Set the textbox to

=DCount("*","TableName","[Overall Performance]=1")
Jun 4 '07 #4
mim77
7
Try putting textboxes on the form. Set the textbox to

=DCount("*","TableName","[Overall Performance]=1")

I'm getting a #Error message, and there IS data in the table.
Jun 4 '07 #5
JConsulting
603 Expert 512MB
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, 2, 3, or 4. I just can't seem to come up with the right statement for a report that will give me the number of records with, for example, 1 as the value.
Any ideas?
Thanks!
if you're doing this for a report, you can add fields to your report's recordsource (aka the query)

But your question is confusing, are you adding fields to a form or a report?
Jun 4 '07 #6
MMcCarthy
14,534 Expert Mod 8TB
I'm getting a #Error message, and there IS data in the table.
Is Overall Preformance a number or a text field?
Jun 4 '07 #7
mim77
7
Is Overall Preformance a number or a text field?

Hi,


It is a number field.
Jun 4 '07 #8
MMcCarthy
14,534 Expert Mod 8TB
Try changing it to this

=DCount("[Overall Performance]","TableName","[Overall Performance]=1")
Jun 4 '07 #9
JConsulting
603 Expert 512MB
Hi,


It is a number field.

Sorry to interrupt.

Where exactly are you putting these calculated fields?

I mentioned earlier that if you're doing this for a report, then you should add them as part of the recordsource....otherwise you can use them in a Group footer. You will not be able to produce a total in the detail section of a report using this method as far as I'm aware.
Jun 4 '07 #10
MMcCarthy
14,534 Expert Mod 8TB
Sorry to interrupt.

Where exactly are you putting these calculated fields?

I mentioned earlier that if you're doing this for a report, then you should add them as part of the recordsource....otherwise you can use them in a Group footer. You will not be able to produce a total in the detail section of a report using this method as far as I'm aware.
Not a problem.

JC is right. This code is for a textbox on a form which is what you asked for.
Jun 4 '07 #11
mim77
7
Try changing it to this

=DCount("[Overall Performance]","TableName","[Overall Performance]=1")

Hi,

Now I'm getting an "invalid string" error message.

I'm beginning to wonder now... Does this has anything to do with the fact that my report has an underlying query that is picking out needed data?
Jun 4 '07 #12
MMcCarthy
14,534 Expert Mod 8TB
Hi,

Now I'm getting an "invalid string" error message.

I'm beginning to wonder now... Does this has anything to do with the fact that my report has an underlying query that is picking out needed data?
What is the name of your table and what is the name of the field Overall Preformance in the table, exactly?
Jun 4 '07 #13
mim77
7
What is the name of your table and what is the name of the field Overall Preformance in the table, exactly?

The Table name is WDPS Data Table
The field Overall Performance is named Overall Performance
Jun 5 '07 #14
MMcCarthy
14,534 Expert Mod 8TB
The Table name is WDPS Data Table
The field Overall Performance is named Overall Performance
then your statment should appear like this

Expand|Select|Wrap|Line Numbers
  1.  
  2. =DCount("[Overall Performance]","[WDPS Data Table]","[Overall Performance]=1")
  3.  
Jun 5 '07 #15
mim77
7
then your statment should appear like this

Expand|Select|Wrap|Line Numbers
  1.  
  2. =DCount("[Overall Performance]","[WDPS Data Table]","[Overall Performance]=1")
  3.  

It worked!!! Thank you! Thank you! Thank you!
Jun 5 '07 #16
MMcCarthy
14,534 Expert Mod 8TB
It worked!!! Thank you! Thank you! Thank you!
You're welcome.
Jun 6 '07 #17

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

Similar topics

5
by: yvan | last post by:
Approximately once a month, a client of ours sends us a bunch of comma-delimited text files which I have to clean up and then import into their MS SQL database. All last week, I was using a Cold...
17
by: Danny J. Lesandrini | last post by:
The following code works with a standard MDB to navigate to a particluar record (with a DAO recordset, of course) but it's giving me problems in an ADP I'm working on. Dim rs As ADODB.Recordset...
6
by: 6thirty | last post by:
Hi, I've created a stocktaking database using Access XP. This is indexed by two fields - part number and shelf location. I am currently inputting all the data via a form. When I have entered a...
5
by: Ross A. Finlayson | last post by:
Hi, I'm scratching together an Access database. The development box is Office 95, the deployment box Office 2003. So anyways I am griping about forms and global variables. Say for example...
19
by: davidgordon | last post by:
Hi, I need some pointers/help on how to do the following if it possible: In my access db, I have the following: Tables: Products, Sub-Assembly, Product-Pack Table, Products
14
by: David Garamond | last post by:
begin; update t set val=val+1; -- 1000 times commit; How many record versions does it create? 1 or 1000? I'm implementing a banner counter which is incremented at least 2-3 millions a day. I...
16
by: usenet | last post by:
I want to be able to use the record numbers of a sub-form, are they available anyhow in VB (Access 2003)? I want to use the sub-form record number as *part* of the primary key for the table...
12
by: JHNielson | last post by:
I have a simple question, but I can't seem to find the answer. I have this code to count the number of records that pass through a set of processes: It counts how many records go through...
7
by: elainenguyen | last post by:
Hi, I am trying create a query that counts all records which have the field Hypotension=1 (which is Yes), but I only want to count the same customer once. For example: My table has 3 fields:...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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?
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
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...
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...

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.