MS Access returns different results each time

Mezczyzna
Mezczyzna used Ask the Experts™
on
Hello,
I am puzzled.
This query:

SELECT DISTINCTROW Last(dbo_INVENTORY_TRANS.TRANSACTION_DATE) AS LastOfTRANSACTION_DATE, dbo_INVENTORY_TRANS.PART_ID
FROM dbo_INVENTORY_TRANS
GROUP BY dbo_INVENTORY_TRANS.PART_ID
HAVING (((Last(dbo_INVENTORY_TRANS.TRANSACTION_DATE))>#12/31/2012#) AND ((dbo_INVENTORY_TRANS.PART_ID) Is Not Null))
ORDER BY Last(dbo_INVENTORY_TRANS.TRANSACTION_DATE) DESC , dbo_INVENTORY_TRANS.PART_ID;

gives me different results each time I click Run.
The database is linked using ODBC to our ERP database. Nobody is logged in to the ERP, so no transactions are going on.
Difference between each time can come to almost thousand records.

What am I doing wrong?

Microsoft Access 2013. SQL Server 2007.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
You should use Max instead of last.
ste5anSenior Developer

Commented:
What do you want to achieve y using LAST()? Do you run it in Access or SQL Server?
MezczyznaERP Specialist

Author

Commented:
I think I tried, but I will again.
Thank you.
Ensure you’re charging the right price for your IT

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

MezczyznaERP Specialist

Author

Commented:
I want the most recent transaction record on a part.
MezczyznaERP Specialist

Author

Commented:
Max gives me the same number of records each time.
If max is the solution to display the most recent record for inventory transaction, this is the solution.

Thank you.
MezczyznaERP Specialist

Author

Commented:
Thank you, max solved the issue.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial