Easy way to display the most recent status entry.

Easy way to display the most recent status entry.

I started doing this in Excel, but could do this either in Access or Excel  -- whichever is the simplest to implement and easiest run on a daily basis.

Attached is an example of the kind of status report I'm keeping at work for a new group of projects (not actual status).  The list could grow to maybe 500 rows and 100 different Projects.

Status information is entered by Date, Project No and Status comment.  There can be multiple Rows for the same Project in any day.

Date will just show the mm/dd/yy.  I don't want to enter time of day.  (in Excel, I am currently automatically copying the date from the previous row until I manually change it).

The problem to solve is how can I easily display just the most recent Excel row (or Access Record) information for each Project.
Sample-Status-List.gif
LVL 18
WaterStreetAsked:
Who is Participating?
 
rockiroadsConnect With a Mentor Commented:
Thats the query, I gave it a quick test to confirm

Created a table called ProjStatus and contains three fields  ID, ProjectNumber and Status and here is my query

SELECT A.ProjectNo, A.Status
FROM ProjStatus as A, (SELECT Max(ID) as MaxID, ProjectNo FROM ProjStatus GROUP BY ProjectNo) as B
WHERE A.ID = B.MaxID

Returns the last record for each project number

0
 
rockiroadsCommented:
Either store the time as well (store automatically but dont show it!) and so ordering by date/time should do it or within Access ensure your table has a primary key (an autonumber will suffice). You can then create a query and order by the id but in descending order.

select id, mydate, projectno, status
from mytable
order by id desc
0
 
rockiroadsCommented:
You could create a number field in excel also then sort the data by that column but in descending order. A simple way to create a autonumber possibly in excel?
http://www.techonthenet.com/excel/formulas/autonumber.php


0
Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

 
WaterStreetAuthor Commented:
rockiroads,
I tried your suggestion in the first posting, but it shows all the records for each project.  I just want to show the most recent record for each project (which will be the latest)
I'm using the autonumber as the "id," so what I need is to show is only the record for each project that has the highest id.
Thanks
0
 
rockiroadsCommented:
Ok, gotcha

I got to go out , will be back on online in about 40mins. I will post the solution then.

The query will need a subquery to get the max id's per project then use that as a table and link in the main table

from memory as I havent touched access nor sql for ages, and I dont have access on hand to verify it - will do in 40mins or so though

select a.datefield, a.projectnumber, a.status
from mytable as a, (select max(id) as maxid, projectnumber
                                from mytable
                               group by projectnumber) as b
where a.id = b.maxid


0
 
WaterStreetAuthor Commented:
rockiroads,

Thank you very much.  It worked and I modified it for my own purposes -- fyi, see insert below.
Where were you when I need this eight years ago?  :-))
I can now emulate this technique for my other uses.

By the way,  the field name "ProjectNumber" in the table should be "ProjectNo"  right?  If it's okay with you I'll edit it for the change so that your answer in the PAQ works immediately for anyone else who uses it.

Thanks again

WaterStreet,
Core Zone Advisor - Other


Final-Design-Views.jpg
0
 
WaterStreetAuthor Commented:
Perfect - taught me a little more SQL and a techniques I can apply again
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.