A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

count number of records



 
 
Thread Tools Display Modes
  #1  
Old January 13th, 2005, 05:45 PM
Joe_Access
external usenet poster
 
Posts: n/a
Default count number of records

I have a table with several hundred items in it. I have a field that
contains the manufacturer. In the same table I have a field called Item
Number. I want to run a query to number the items for each manufacturer from
1 to n

Example data

"Manufacturer" "Item Number"
A 1
A 2
B 1
A 3
C 1
B 2
B 3
C 2


Can someone help me please
  #2  
Old January 13th, 2005, 06:27 PM
Joseph Meehan
external usenet poster
 
Posts: n/a
Default

Joe_Access wrote:
I have a table with several hundred items in it. I have a field that
contains the manufacturer. In the same table I have a field called
Item Number. I want to run a query to number the items for each
manufacturer from 1 to n

Example data

"Manufacturer" "Item Number"
A 1
A 2
B 1
A 3
C 1
B 2
B 3
C 2


Can someone help me please


From the Help file:
Total records in a query
Calculate totals on all the records in a query

1.. Create a select query in Design view and add the tables whose records
you want to use in the calculation.
2.. Add the fields on which you want to perform calculations and specify
criteria.
3.. Click Totals on the toolbar.
Microsoft Access displays the Total row in the design grid.

4.. For each field in the design grid, click its cell in the Total row,
and then click one of the following aggregate functions: Sum, Avg, Min, Max,
Count, StDev, or Var, or click the other functions, First and Last.
5.. If you want, enter criteria to affect the results of the calculation.
How?

In the query design grid, where you specify criteria determines when the
calculation is performed and can produce different query results.

Note Although the following examples only show queries that calculate
totals, these guidelines apply to calculated fields as well.

Limit groups before performing calculations on groups of records

a.. Specify the criteria in the Group By fields as the following example
shows.


This query totals extended prices for ...

... companies in Canada and the UK only.

Return selected results after calculations are performed

a.. Specify criteria in the field that contains the calculation as the
following example shows.


This query totals extended prices for companies in Canada and the UK
....

... but shows only those that are less than $10,000.

Limit records before they are grouped and before the calculation is
performed

a.. Add to the design grid the field whose records you want to limit,
and then specify criteria in the field's Criteria cell.
If you're calculating totals in the same query, set the Total cell for
the field containing the criteria to Where. This rule applies whether you're
calculating the total on all records or groups of records. (Microsoft Access
automatically clears the Show check box.)

The following example uses the ExtendedPrice field twice, once to limit
the records and once to calculate the total. However, you can use a
different field to limit records by dragging that field to the design grid
and setting its Total cell to Where.



From these records, the query retrieves only those with extended
prices greater than $500.00 before it groups or totals ...

... and then it sums and shows only those totals for companies in
Canada or the UK.

This total for Seven Seas Imports does not include the order for
$210.00.


6.. If you want, sort the results.
7.. Click View on the toolbar to view the results.
Calculate totals on groups of records in a query

1.. Create a select query in Design view and add the tables whose records
you want to use in the calculation.
2.. Add the fields on which you want to perform calculations, define
groupings, and specify criteria.
3.. Click Totals on the toolbar.
Microsoft Access displays the Total row in the design grid.

4.. For the field or fields you want to group on, leave Group By in the
Total cell.
5.. For each field you want to calculate, click its cell in the Total row,
and then click one of the following aggregate functions: Sum, Avg, Min, Max,
Count, StDev, or Var, or click the other functions, First and Last.
6.. If you want, enter criteria to affect the results of the calculation.
How?

In the query design grid, where you specify criteria determines when the
calculation is performed and can produce different query results.

Note Although the following examples only show queries that calculate
totals, these guidelines apply to calculated fields as well.

Limit groups before performing calculations on groups of records

a.. Specify the criteria in the Group By fields as the following example
shows.


This query totals extended prices for ...

... companies in Canada and the UK only.

Return selected results after calculations are performed

a.. Specify criteria in the field that contains the calculation as the
following example shows.


This query totals extended prices for companies in Canada and the UK
....

... but shows only those that are less than $10,000.

Limit records before they are grouped and before the calculation is
performed

a.. Add to the design grid the field whose records you want to limit,
and then specify criteria in the field's Criteria cell.
If you're calculating totals in the same query, set the Total cell for
the field containing the criteria to Where. This rule applies whether you're
calculating the total on all records or groups of records. (Microsoft Access
automatically clears the Show check box.)

The following example uses the ExtendedPrice field twice, once to limit
the records and once to calculate the total. However, you can use a
different field to limit records by dragging that field to the design grid
and setting its Total cell to Where.



From these records, the query retrieves only those with extended
prices greater than $500.00 before it groups or totals ...

... and then it sums and shows only those totals for companies in
Canada or the UK.

This total for Seven Seas Imports does not include the order for
$210.00.


7.. If you want, sort the results.
8.. Click View on the toolbar to view the results.
Note If you add a calculated field that includes one or more aggregate
functions to a query in which you're calculating totals on all the records,
you must set the calculated field's Total cell to Expression


--
Joseph Meehan

26 + 6 = 1 It's Irish Math






















Attached Images
File Type: gif blueup.gif (175 Bytes, 80 views)
File Type: gif totals.gif (106 Bytes, 61 views)
File Type: gif cqrytot7.gif (4.6 KB, 66 views)
File Type: gif callout1.gif (95 Bytes, 54 views)
File Type: gif callout2.gif (98 Bytes, 55 views)
File Type: gif cqrytot8.gif (5.7 KB, 69 views)
File Type: gif cqrytot9.gif (6.3 KB, 61 views)
File Type: gif callout3.gif (97 Bytes, 63 views)
File Type: gif view.gif (120 Bytes, 57 views)
File Type: gif bluedrop.gif (176 Bytes, 57 views)
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
incorrect sums in report using 2 tables jkendrick75 Setting Up & Running Reports 22 December 13th, 2004 02:19 PM
Pivot Table Access 2000? Air-ron General Discussion 2 October 29th, 2004 06:19 PM
count records based on date range keith0628 General Discussion 1 October 26th, 2004 07:51 PM
How to count the total records on a particular page Irshad Alam Setting Up & Running Reports 1 September 2nd, 2004 02:05 PM
COUNT: Counting the number of times "X" comes up after the occurrence of "Y" DrSues02 General Discussion 5 August 3rd, 2004 06:35 AM


All times are GMT +1. The time now is 12:29 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.