Link to home
Start Free TrialLog in
Avatar of WaterStreet
WaterStreetFlag for United States of America

asked on

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
Avatar of rockiroads
rockiroads
Flag of United States of America image

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?
http://www.techonthenet.com/excel/formulas/autonumber.php


Avatar of WaterStreet

ASKER

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


ASKER CERTIFIED SOLUTION
Avatar of rockiroads
rockiroads
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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
Perfect - taught me a little more SQL and a techniques I can apply again