Thread: Run-query error
View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Jamie Collins Jamie Collins is offline
external usenet poster
 
Posts: 593
Default Run-query error

"JohnDing" wrote ...

SQL = "SELECT Period, CDF_No, SAFE_No, Invoice_No,
Currency, Sum(Total_Amount) AS Total_Amount_Sum, Country
FROM EXPSALESDB GROUP BY Invoice_No HAVING ((Period ='" &
Period & "')) ORDER BY Invoice_No"


You would need to add to your GROUP BY cluse the columns in you SELECT
clause that are not being used in a set function (e.g. SUM) i.e. add
Period, CDF_No, SAFE_No, [Currency] to the GROUP BY clause. BTW I
think you need Currency in brackets because it is a reserved word in
Jet 4.0 (and is not very useful so consider renaming).

Jamie.

--