This is my first time posting so I'm sorry if I make any mistakes. So I have a database in access and I am trying to get the top 10 Client ID, the number of reservations made by the client and the sum of those reservations. I have this Sql code in MS Access and it works there, but when I enter it in Visual Basic, I get te following error. SQL syntax:
SELECT top 10 Clienti.CodCl, sum(Rezervari.SumaTotala) ,
count(Rezervari.CodRezervare)
FROM Clienti
INNER JOIN Rezervari ON (Clienti.CodCl = Rezervari.CodCl)
where datarezervarii BETWEEN #6/21/2020# AND #6/23/2020#
group by Clienti.CodCl
order by sum(Rezervari.SumaTotala) desc
The result table in access
Visual basic error :
System.Data.OleDb.OleDbException: 'The SELECT statement includes a reserved word or an argument name that is misspelled or missing, or the punctuation is incorrect.'
Thank you.

SUMexpression in yourORDER BY. UseORDER BY 2instead, where the2means the second column in the SELECT. Does that fix things?