ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Syntax error Q (https://www.excelbanter.com/excel-programming/319433-syntax-error-q.html)

John[_78_]

Syntax error Q
 

Could anyone point out the mistake in the line below, its a syntax error,
I've a feeling its got to do with the 'FromDate' and 'ToDate' part

..CommandText = Array("SELECT tblSalesMixHistory.StoreNo,
tblSalesMixHistory.SalesDate, tblSalesMixHistory.Item,
tblSalesMixHistory.MenuSortName, tblSalesMixHistory.Sold" & Chr(13) & "" &
Chr(10) & "FROM `E:\History`.tblSalesMixHistory tblSalesMixHistory" &
Chr(13) & "" & Chr(10) & "WHERE (tblSalesMixHistory.Item=100) AND
(tblSalesMixHistory.SalesDate={ts '" & (FromDate) & "'} And
tblSalesMixHistory.SalesDate<={ts '" & (ToDate) & "'}) AND
(tblSalesMixHistory.Item=101) AND (tblSalesMixHistory.SalesDate={ts '" &
(FromDate) & "'} And tblSalesMixHistory.SalesDate<={ts '" & (ToDate) & "'})
AND (tblSalesMixHistory.Item=102) AND (tblSalesMixHistory.SalesDate={ts '"
& (FromDate) & "'} And tblSalesMixHistory.SalesDate<={ts '" & (ToDate) &
"'})" & Chr(13) & "" & Chr(10) & "ORDER BY tblSalesMixHistory.StoreNo,
tblSalesMixHistory.SalesDate, tblSalesMixHistory.Item")




All times are GMT +1. The time now is 05:48 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com