473,419 Members | 4,314 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,419 software developers and data experts.

Group by Employee and Project Date (was Access Help)

I have just recently started to learn how to use Access and have been moving along pretty smoothly so far, but I can't find a way around this problem.
I have a list that shows employees and associated projects along with dates of when the project was started. Some employees have zero and some have multiple projects. I need to show the number of projects that are more than 90 days old per employee.
I have created a query to list which projects are older than 90 days, and I planned to use a count function on a subreport to show how many were overdue per person but I can only get it to output the number of overdue projects for the whole group. Does anyone have any suggestions?
Thanks
Aug 27 '07 #1
7 2723
Jim Doherty
897 Expert 512MB
I have just recently started to learn how to use Access and have been moving along pretty smoothly so far, but I can't find a way around this problem.
I have a list that shows employees and associated projects along with dates of when the project was started. Some employees have zero and some have multiple projects. I need to show the number of projects that are more than 90 days old per employee.
I have created a query to list which projects are older than 90 days, and I planned to use a count function on a subreport to show how many were overdue per person but I can only get it to output the number of overdue projects for the whole group. Does anyone have any suggestions?
Thanks

If you post the tablename fieldnames and your query syntax thus far we should be able to help unravel it
Aug 27 '07 #2
missinglinq
3,532 Expert 2GB
Please remember to provide a meaningful Title for any threads you start! This helps to ensure that other members, and also the general public, will have a better chance of finding answers to any similar questions. It is difficult for the experts to answer questions when there is not enough details provided to understand the problem. I have re-titled your post for this reason.

Please take the time to read the Posting Guidelines, paying particular attention to "Give a clear title to your question" as well as "Give as much detail as possible."


Thank you and Welcome to TheScripts!!

Linq ;0)>
Aug 28 '07 #3
I have a query titled, qryEMRAs, with the following fields: name, department, empl_number, emra (emra is a project number), and emra_date_created. I want to be able to output the number of EMRAs that each employee has, the number of EMRAs that are older than 90 days, and the oldest EMRA that is under each employee in a subreport.

For example if:
Name........emra.....................emra_date_cre ated
John..........1-2400-7-5036........7/23/2007
John..........1-2821-7-5004........3/28/2007
John..........6-2560-7-5004........6/17/2007
Then I want the following to be in a report
Employee....Number of EMRAs....EMRAs Overdue....Oldest in Que
John........................3..................... ........1.........................153

I currently have a report titled, subrptEMRAs, that outputs the number of projects by using =Count([empl_number]) in a text box, and the oldest project under each employee by using =Max(Date()-[emra_date_created]) in a text box. qryEMRAs is the Record Source for this report.
I can't get the number that are overdue in the report.

I appreciate your help. Sorry about my lousy first post. I hope this is a little more clear.
Aug 28 '07 #4
missinglinq
3,532 Expert 2GB
Much improved, mefreeman21, as are your chances for help from the members here,now that your problem has been restated! I do very little of the type of reporting you're attempting here, so I won't jump in and muddy up the waters, but will leave you to some of our members who do such!

Good luck!

Linq ;0)>
Aug 28 '07 #5
Jim Doherty
897 Expert 512MB
I have a query titled, qryEMRAs, with the following fields: name, department, empl_number, emra (emra is a project number), and emra_date_created. I want to be able to output the number of EMRAs that each employee has, the number of EMRAs that are older than 90 days, and the oldest EMRA that is under each employee in a subreport.

For example if:
Name........emra.....................emra_date_cre ated
John..........1-2400-7-5036........7/23/2007
John..........1-2821-7-5004........3/28/2007
John..........6-2560-7-5004........6/17/2007
Then I want the following to be in a report
Employee....Number of EMRAs....EMRAs Overdue....Oldest in Que
John........................3..................... ........1.........................153

I currently have a report titled, subrptEMRAs, that outputs the number of projects by using =Count([empl_number]) in a text box, and the oldest project under each employee by using =Max(Date()-[emra_date_created]) in a text box. qryEMRAs is the Record Source for this report.
I can't get the number that are overdue in the report.

I appreciate your help. Sorry about my lousy first post. I hope this is a little more clear.

OK ...two main parts here that assumes you have a table called tblEMRA

This is the first bit of sql... paste it into the SQL window save explicitly as a query called qryEMRAs. This gives a defined list of employees and uses the DATEDIFF function to give a column outlining the number of days existing between the emra_date_created date and todays date. This query you can use for something else I guess, thats why I haven't subqueried it as part of one huge block of SQL

Expand|Select|Wrap|Line Numbers
  1. SELECT tblEMRA.Name, tblEMRA.department, tblEMRA.empl_number, tblEMRA.emra, DateDiff("d",[emra_date_created],Date()) AS DaysSinceStart
  2. FROM tblEMRA;
Second part

Now paste this as a separate query and save it to any name you like.
It references the first query (qryEMRAs) explicitly so thats why the naming of the first was necessary. It gives you the output you required (which of course you can parametise later if you wish, should the ceiling for the number of days change. You can base your report on this query. It only counts on all employees that have had an EMRA created in the 90 day leading up to today in other words not a count on every employee whether or not they have had an emra created subtle difference. I sort of assumed you were only interested in those that HAD emras created. Thats why its helpful to post as much info as you can in order to work the logic .


Expand|Select|Wrap|Line Numbers
  1. SELECT emras.name, (Select Count(emra) from qryEMRAS where [name]=Emras.[Name]) AS EMRAS, (Select Count(name) from tblEMra where [name]=Emras.[Name] and Datediff("d",emra_date_created,Date())>90) AS [EMRAs Overdue], Max(emras.DaysSinceStart) AS OldestInQue
  2. FROM [SELECT tblEMRA.name, tblEMRA.department, tblEMRA.empl_number, tblEMRA.emra, DateDiff("d",[emra_date_created],Date()) AS DaysSinceStart
  3. FROM tblEMRA
  4. WHERE (((DateDiff("d",[emra_date_created],Date()))>90))]. AS emras
  5. GROUP BY emras.name;

Hope this helps you

Regards

Jim
Aug 28 '07 #6
Thank-you so much Jim! That worked great!

Thanks for teaching me a fair bit about SQL also.

Much appreciated.
-mefreeman21
Aug 29 '07 #7
Jim Doherty
897 Expert 512MB
Thank-you so much Jim! That worked great!

Thanks for teaching me a fair bit about SQL also.

Much appreciated.
-mefreeman21
You're welcome I'm glad it helped you out :)
Aug 29 '07 #8

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

Similar topics

17
by: Lapchien | last post by:
My table has a record called date/time - filled (not surprisingly) with a date and time. I can format the date in one query field, also the time, using format in an expression. My user wants me...
5
by: Alicia | last post by:
Yes, but will that skip a week and group by the date for me? I basically wanted something that would do a count of the dates, then group them by their week name.. BEFORE: Resource Date ...
6
by: wedgea | last post by:
Im trying to build a database for my DBMS class. I need the code for a form that makes it so when a user clicks a combo box and selects a number from it it fills in the rest of the form based on...
3
by: news.giganews.com | last post by:
Does anyone know if there's an easy way to export or copy the relationship structure from one mdb to a new one? The relationships in the db are time consuming to reproduce. I am trying to make a...
0
by: Zachary Hilbun | last post by:
I am developing an ASPNET app using c# on a remote server. The server lost a hard drive and one probject was recovered on that server and one was not. I can't compile or syncronize anymore on the...
4
by: rnash1 | last post by:
I am tring to get a calendar control to just update to the current date when the form is opened, But for some reason cant get it to work. The calendar is always on the same date. This is what I put...
2
by: amolbehl | last post by:
Can anyone tell me wht this expression does in ACCESS IIf(>1,(-)/(-1),) AS ExcludeOutlierAvg I Encountered this in a query I do not Understand , mean Also in , SumOfQty is a field in...
1
by: ohadm | last post by:
i've encountered a weired problem while retrieving date from access database: i'm using ASP VBscript\Jscript the data is stored using the "date()" command on VBscript code by someone else. when...
2
by: Handle | last post by:
I want to customize some aspx / ascx files of a precompiled site (the project portofolio web access site). I have no access to source code. Using Visual Studio, when I try to edit one these 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: 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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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...
0
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 project—planning, coding, testing,...
0
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...

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.