473,756 Members | 2,900 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

counting assemblies per year

I have a database with records dating back to the year 2001
I want to know how many of each Assembly was tested per year
I have fields :
TestDate
AssemblyNo
I am new to access but was able to get the count to work with just one year
(if I query for that year first).
how do I get access to count for each year
Nov 13 '05 #1
4 1394
SELECT Year(TestDate) As TestYear, AssemblyNo, Count(*)
FROM MyTable
GROUP BY Year(TestDate), AssemblyNo

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)
"Wayne B. Stanley" <ws******@wilco xon.com> wrote in message
news:e2******** *************** ***@posting.goo gle.com...
I have a database with records dating back to the year 2001
I want to know how many of each Assembly was tested per year
I have fields :
TestDate
AssemblyNo
I am new to access but was able to get the count to work with just one year (if I query for that year first).
how do I get access to count for each year

Nov 13 '05 #2
Create a query based on the table that contains TestDate and Assemblyno. In the
first column of the query enter this expression:
YearOfTestDate: Year([TestDate])
Pull down AssemblyNo into the second column.

Click on the Sigma button on the toolbar at the top of the screen, (Looks like a
capital E). This makes your query a totals query. Go down under AssemblyNo and
use the dropdown list to change GroupBy to Count. When you run the totals query
you will get the total number of Assemblies for each year.

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
re******@pcdata sheet.com
www.pcdatasheet.com
"Wayne B. Stanley" <ws******@wilco xon.com> wrote in message
news:e2******** *************** ***@posting.goo gle.com...
I have a database with records dating back to the year 2001
I want to know how many of each Assembly was tested per year
I have fields :
TestDate
AssemblyNo
I am new to access but was able to get the count to work with just one year
(if I query for that year first).
how do I get access to count for each year

Nov 13 '05 #3
"Wayne B. Stanley" <ws******@wilco xon.com> wrote in message
news:e2******** *************** ***@posting.goo gle.com...
I have a database with records dating back to the year 2001
I want to know how many of each Assembly was tested per year
I have fields :
TestDate
AssemblyNo
I am new to access but was able to get the count to work with just one year (if I query for that year first).
how do I get access to count for each year

Start by creating a table to hold the years:

create table calendar
(
yr int not null primary key,
yrStart datetime not null,
yrEnd datetime not null
)

Fill the table with all the years you will even need, e.g. for 2001

insert into calendar(yr, yrStart, yrEnd)
values (2001, #01/01/2001#, #01/01/2002#)

Then this should give what you're looking for:

select c.yr, count(a.Assembl yNo) as assemblies
from calendar as c
left outer join assemblies as a on c.yrStart <= a.TestDate
and a.TestDate < c.yrEnd
group by c.yr
order by c.yr







Nov 13 '05 #4
Wayne B. Stanley wrote:
I have a database with records dating back to the year 2001
I want to know how many of each Assembly was tested per year
I have fields :
TestDate
AssemblyNo
I am new to access but was able to get the count to work with just one year
(if I query for that year first).
how do I get access to count for each year


I'm going to assume not all of the items were tested. In this case I
would want to get a count of those tested. If a date is null, IsDate is
False = 0. If the date is filled in, IsDate is True = -1 and Abs
converts it to a positive.

I usually do something like this. I create an expression by dragging
TestDate to a column in the query builder.
WasTested : Abs(IsDate([TestDate]))

Now I drag down TestDate and get the Year/
YearTested : Year([TestDate])

I make this a Totals query and in the Totals row keep YearTested to
GroupBy and select Sum for WasTested.

You could also drag down TestDate to a third column and set the Total
row to Count to get the total number of records. Then you have a value
to get the total records and the total Tested and with those values you
can get the count of records not tested.

Nov 13 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
4470
by: Mario T. Lanza | last post by:
I am working with Visual Studio. The solution I am developing is composed of about 8 separate projects. Some of these projects represent different tiers in the N-tiered architecture (data, business logic, presentation, etc.). Right now, some of the projects are inter-related and reference each other using Project References. When I select "Rebuild Solution" to compile, each project is successfully compiled into its own directory (and...
6
6067
by: Binesh | last post by:
Hi I used Interop assemblies to read Excel data into DataSet. I am able to run it successfully on my workstation(windows XP and VS .Net 7 and MS Office XP) but when I port my code to server(Windows 2000,.Net Framework 1.1,NO MS OFFICE) I get clsid not found. I believe this is because I do not have MS Office installed on my server( I might be wrong) 1. How do I get rid of this problem 2. If having strong names for the Interop assemblies...
7
12813
by: Bambero | last post by:
Hello all Problem like in subject. There is no problem when I want to count days between two dates. Problem is when I want to count years becouse of leap years. For ex. between 2002-11-19 2003-11-19
18
2943
by: ChadDiesel | last post by:
I appreciate the help on this group. I know I've posted a lot here the last couple of weeks, but I was thrown into a database project at my work with very little Access experience. No other employee knows anything about Access. I've searched Google Groups, and that has been a lot of help, but there are some questions that I just can't find the answer to. I'll try to take it easy on the group after this question. I have one more...
3
2077
by: Claudio Pacciarini | last post by:
Hi everyone, I have a question about .NET code sharing and reuse, and also about application design best practices / guidelines. Currently, we have many different .NET projects in source depot. Although they are different, in some of them we share C# code by referencing source files that are external (not part of the projects) on each project. For instance, some of our projects have the typical “sources” file with:
2
1553
by: crabb | last post by:
I would like to know if anyone knows how to set up an app that would count the number of specific days in a user defined year. example, how many Sundays, Mondays, Tuesdays, etc. in 2007 or a user defined year, june 07 - june 08. I really don't know where to start, but we are working on financial data and i need this for calculations. Thanks, Eric
8
7120
by: crassostrea | last post by:
Hello and Happy New Year, I have two tables in Access 2003 (Windows XP) with similar, but different, information. Well call them table A and table B. I want to count the number of records in each table and display how many of each there are, and the total, by year: 2008 A B A+B 2007 A B A+B 2006 A B A+B Right now I have a counting query for each of the tables, separately, but I cant figure out how to properly join...
7
10600
by: WTH | last post by:
I am now aware (I am primarily a C++ developer) that in C# if you reference the same interface from the same file in two different projects the types are actually incompatible. I found this out because I have written a generic plugin system for my current and future C# needs. I defined a base plugin system interface named IPlugin (original, I know...) which contains some basic plugin infomration all plugins of this system must expose...
5
1517
by: Brian S. | last post by:
Hi, I am trying to calculate the number of DayOfWeek in a month.. for instance.. this month April I want to know how many tuesdays there are in this month, this year I try to use where intDOW = FirstDayOfWeek.Tuesday dtmFirst = #4/1/2008#, dtmLast = #4/30/2008# DateDiff(DateInterval.Weekday, dtmFirst, dtmLast, intDOW) now I would think from reading.. that i would end up with 5, but i am ending
0
9456
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look ! Part I. Meaning of...
0
9275
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9872
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9843
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8713
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 projectplanning, coding, testing, and deploymentwithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7248
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6534
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
2
3358
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2666
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.