ms access 2010 - Last Function in Query -
so have database keeps tracks of projects, project updates, , update dates. have form subform displays project name , recent update made said project. brought attention however, recent update project not display correctly. ex: shows update date of 4/6/2017 actual update text 3/16/2017.
doing spot research, learned access not store records in particular order, , last function not give last record.
i scouring google find solution no avail of yet , have turned here in hopes of solution or idea. thank insight can provide in advance!
other details: tblprojects has fields
- id
- owner
- category_id
- project_name
- description
- resolution_date
- priority
- resolution_category_id
tblupdates has these fields:
- id
- project_id
- update_date
- update
there no built-in last function aware of in access or vba, seeing used?
if sub-form bound directly tblupdates, ought able sort sub-form in descending order based on either id or update_date.
if have query joining 2 tables, , trying single row returned tblupdates, that, assuming id column in tblupdates autonumber. if not, replace order id order update_date desc
select a.*, (select top 1 update tblupdates b a.id = b.project_id order id desc ) last_update tblprojects a;
Comments
Post a Comment