When I try to use ADODB to connect on an Excel DB, it says:
you try to execute a query without a specified expression <Destinataire>
Here’s my code:
MyQuery = "Select Destinataire, SUM(" & Entete & ") AS NombreTotal FROM [Feuil1$] " _
& "WHERE [DateMad] Between #" _
& Format(date_deb, "yyyy/mm/dd") _
& "# And #" & Format(date_fin, "yyyy/mm/dd") & "#" & Query3 & ""
objRecordSet.Open MyQuery, objConnection, adOpenStatic, adLockOptimistic
What’s wrong with it?
You forgot the
group byThe query should look like this
In your code it should be like this
Here’s a tuto about the GROUP BY clause