I have another problem with generating queries in code
I get a SQL syntax error which I have narrowed down to the last addition to the SQL string (marked with*)
Function SQLGumHist(StartD)
strSQL = "SELECT "
strSQL = strSQL & "WMSHIST.WM_INVOICE_DATE, WMSHIST.WM_STATUS, "
strSQL = strSQL & "WMSTRAN.WT_NOMCC, WMSTRAN.WT_PRODUCT, WMSTRAN.WT_PRINT, "
strSQL = strSQL & "WMSTRAN.WT_NET_TOTAL, WMSTRAN.WT_LENGTH, WMSTRAN.WT_WIDTH, WMSTRAN.WT_UNIT_PRICE "
strSQL = strSQL & "FROM "
strSQL = strSQL & "WINDMILL.WMSHIST WMSHIST, WINDMILL.WMSTRAN WMSTRAN "
strSQL = strSQL & "WHERE "
strSQL = strSQL & "WMSHIST.THIS_RECORD = WMSTRAN.PARENT_RECORD "
strSQL = strSQL & "AND ((WMSHIST.WM_STATUS=18) AND (WMSTRAN.WT_NOMCC= ""GUM"" )) "
*strSQL = strSQL & "AND ((WMSHIST.WM_INVOICE_DATE >= '" & Format(StartD, "yyyy-mm-dd") & "'"
SQLGumHist = strSQL
End Function
I get confused with the quote marks and i expect theses are wrong, but I have not been able to see how.
Can anyone help please
John
Bookmarks