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.
LVL 18
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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
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?

WaterStreetAuthor Commented:
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.
IT Pros Agree: AI and Machine Learning Key

We’d all like to think our company’s data is well protected, but when you ask IT professionals they admit the data probably is not as safe as it could be.

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

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

Returns the last record for each project number


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
WaterStreetAuthor Commented:

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

Core Zone Advisor - Other

WaterStreetAuthor Commented:
Perfect - taught me a little more SQL and a techniques I can apply again
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.