# MS Access Question

**URL:** <https://boards.straightdope.com/t/ms-access-question/512812>\
**Category:** Factual Questions\
**Created:** [October 6, 2009, 1:31pm UTC](https://boards.straightdope.com/t/ms-access-question/512812 "2009-10-06T13:31:52Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![StGermain](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/stgermain/32/2868_2.png) [@StGermain](https://boards.straightdope.com/u/StGermain)\
**Post date:** [October 6, 2009, 1:31pm UTC](https://boards.straightdope.com/t/ms-access-question/512812/1 "2009-10-06T13:31:52Z")

</div>

I have a query that has a date value and a text comment associated with the date (notes entered on a specific date). I need to set a criteria which gives me the note entered. Using “Last” in the total field doesn’t work. Is there some way I can set the criteria to give me the greatest value? If I put that criteria in the date field, I should be able to see only the most recent note.

Thanks,

StG

---

<div class="post-metadata">

**Author:** ![K364](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/k364/32/5_2.png) [@K364](https://boards.straightdope.com/u/K364)\
**Post date:** [October 6, 2009, 3:34pm UTC](https://boards.straightdope.com/t/ms-access-question/512812/2 "2009-10-06T15:34:19Z")

</div>

I think you need MAX of the date, not LAST

---

<div class="post-metadata">

**Author:** ![SCSimmons](https://avatars.discourse-cdn.com/v4/letter/s/e495f1/32.png) [@SCSimmons](https://boards.straightdope.com/u/SCSimmons)\
**Post date:** [October 7, 2009, 1:18am UTC](https://boards.straightdope.com/t/ms-access-question/512812/3 "2009-10-07T01:18:01Z")

</div>

If I understand your question correctly, you need a correlated subquery to do this. Either more than one query, joined together, which is the typical way to do this; or, you can put a SQL query in the criteria row. Something like this:  
=(SELECT Max([CommentDate]) From tblComments)

---

<div class="post-metadata">

**Author:** ![StGermain](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/stgermain/32/2868_2.png) [@StGermain](https://boards.straightdope.com/u/StGermain)\
**Post date:** [October 7, 2009, 3:22pm UTC](https://boards.straightdope.com/t/ms-access-question/512812/4 "2009-10-07T15:22:07Z")

</div>

I ended up with more than one query and used Max instead of Last. I’ve got it working properly now (it seems. I’m sure one of the users I built this for will come back and want something changed).

Thanks for your help.

StG
