Access does not necessarily store results in the order they were
entered. You must have a default index that is causing the results to be
sorted in the order you are showing. You cannot depend on this - at any
time, Access may decide to retrieve the results in a different order.
The only way to make sure the proper order is used is to always use an
ORDER BY clause.

While I usually recommend against using the Last() aggregate function,
since it appears your definition of "last" refers to the GDate column,
you can try adding an ORDER BY clause to a subquery so that it orders by
GDate:

While this might work, it will not be portable to other databases
(should you ever decide to upsize to SQL Server perhaps). The Last()
aggregate function is a Jet (Access) proprietary function. While it will
complicate the query, using the MAX aggregation will be safer. Like
this:

Share This Page

Welcome to The Coding Forums!

Welcome to the Coding Forums, the place to chat about anything related to programming and coding languages.

Please join our friendly community by clicking the button below - it only takes a few seconds and is totally free. You'll be able to ask questions about coding or chat with the community and help others.
Sign up now!