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

How to count records in a table, and display results on a report?

ChaseCox
294 100+
Hello Everyone,

I am wanting to count the occurence of different records, for example:

MOT484354
PRN487522
COM45757
COM45775
PRN124872
PRN127754
MOT445778
COM444588

The results should be something like:

MOT - 2
PRN - 3
COM - 3

*The first 3 charachters let me know what the record is.

Any thoughts would be greatly appreciated.
Apr 19 '07 #1
13 2176
Rabbit
12,516 Expert Mod 8TB
Group by Left([Field], 3)
And use a count of the field.
Apr 19 '07 #2
ChaseCox
294 100+
Group by Left([Field], 3)
And use a count of the field.
Thanks for the help. Is there away to get only one page report that gives a snapshot of the data in the table? I just want to be able to say that there were x number of this and y number of that, stuff like that.
Apr 19 '07 #3
Rabbit
12,516 Expert Mod 8TB
That's what the grouping and counting should do, Group and count in a query and base the report off that.
Apr 19 '07 #4
ChaseCox
294 100+
That's what the grouping and counting should do, Group and count in a query and base the report off that.
I am not understanding what you are saying, could you explain more please?
Apr 19 '07 #5
Rabbit
12,516 Expert Mod 8TB
If you have a query that groups by Left([Field], 3) and does a count on said field, the query will return the results you were looking for in Post 1, which is a summary of how many occurences fall under the 3 letter code.

Then you just make a report using this query.
Apr 19 '07 #6
ChaseCox
294 100+
If you have a query that groups by Left([Field], 3) and does a count on said field, the query will return the results you were looking for in Post 1, which is a summary of how many occurences fall under the 3 letter code.

Then you just make a report using this query.
One more question, how do you make a query group?
Apr 19 '07 #7
Rabbit
12,516 Expert Mod 8TB
View > Totals
You should be able to set grouping and aggregate functions now.
Apr 19 '07 #8
ChaseCox
294 100+
I am using the following code:

Expand|Select|Wrap|Line Numbers
  1. SELECT MaterialResult.PART_PART_NBR
  2. FROM MaterialResult
  3. GROUP BY MaterialResult.PART_PART_NBR
  4. HAVING (((MaterialResult.PART_PART_NBR)=Mid([PART_PART_NBR],1,3)));
  5.  
This returns only one record, that is not relevant, any thoughts?
Apr 19 '07 #9
Rabbit
12,516 Expert Mod 8TB
I am using the following code:

Expand|Select|Wrap|Line Numbers
  1. SELECT MaterialResult.PART_PART_NBR
  2. FROM MaterialResult
  3. GROUP BY MaterialResult.PART_PART_NBR
  4. HAVING (((MaterialResult.PART_PART_NBR)=Mid([PART_PART_NBR],1,3)));
  5.  
This returns only one record, that is not relevant, any thoughts?
My thought is you totally ignored my previous posts.

Expand|Select|Wrap|Line Numbers
  1. SELECT Left(PART_PART_NBR, 3) AS ThreeLetterCode, Count(PART_PART_NBR) AS CountOfPart
  2. FROM MaterialResult
  3. GROUP BY Left(PART_PART_NBR, 3);
  4.  
Apr 19 '07 #10
ChaseCox
294 100+
Thanks for the help my friend
Apr 19 '07 #11
NeoPa
32,556 Expert Mod 16PB
ChaseCox,
Have you managed to resolve your problem?
It seems to me you were struggling a bit to understand what Rabbit was saying maybe?
Be assured, he's right on the button, but I wanted to be sure you had caught up with him as it were.
Let us know if you need more help or if the issue is resolved.

-NeoPa.
Apr 25 '07 #12
ChaseCox
294 100+
I got it to work and it works fine. Thanks Rabbit.
Apr 26 '07 #13
Rabbit
12,516 Expert Mod 8TB
Good Luck.
Apr 26 '07 #14

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

Similar topics

5
by: Cro | last post by:
Hello Access Developers, I'd like to know if it is possible to perform a count in an expression that defines a control source. My report is based on a query. In my report, I want a text box to...
2
by: SJM | last post by:
I have a report that displays records of real estate properties. It is possible for each property to appear a number of times for various reasons. Each record however is unique. What I would like...
1
by: Coy Howe | last post by:
This one seems bizarre! We have a database consisting of a main table and 12 - 15 "sub" tables, which are connected via cascading relationships. The database performs many complex calculations...
2
by: Stephen | last post by:
Hello all Run into a problem with a count query in access. It seems to count either all the results or none depending on criteria even though I have a query that selects the difference in...
2
by: jonathan184 | last post by:
Hi I am having a problme where the results of the sql count is not matching the results of the perl script sql count. The script was working fine up till Wed last week and after that the results...
3
by: wvmbark | last post by:
First time poster... I just found this forum and it appears there's plenty of people here that could make short work of problem that's been driving me absolutely bonkers for months. Every day we...
2
by: Pete | last post by:
I need to create a single query (Not a SQL query) against a single table that counts the number of records in the table, where the single field "tmp" contains specific string values If the field...
2
by: mfaisalwarraich | last post by:
Hi Everybody, I am using the following code to get the recordset of an external database. Dim dbPatients As Database Dim rsCountPatients As Recordset ' to count number of...
12
by: petter | last post by:
Hi! I have two questions: one question that regards the COUNT-function, and one about how to display a month even if I don’t have any data for that month. I have an Access database where I want...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.