Bob
The data source is my companies Sage accounting system so its not really possible to send it. I could pull part of two of the files I am using into two worksheets, but I dont think you can use an ODBC link from Excel to Excel. If that would help let me know
Any way here is the Function I use to generate the SQL string.
Function SQLGUMCURR(StartD)
strSQL = "SELECT "
strSQL = strSQL & "WMORDER.WM_INVOICE_DATE, WMORDER>WM_STATUS, "
strSQL = strSQL & "WMTRANS.WT_NOMCC, WMTRANS.WT_PRODUCT, WMTRANS.WT_PRINT, "
strSQL = strSQL & "WMTRANS.WT_NET_TOTAL, WMTRANS.WT_LENGTH, WMTRANS.WT_WIDTH, WMTRANS.WT_UNIT_PRICE "
strSQL = strSQL & "FROM "
strSQL = strSQL & "WINDMILL.WMORDER WMORDER, WINDMILL.WMTRANS WMTRANS "
strSQL = strSQL & "WHERE "
strSQL = strSQL & "WMORDER.THIS_RECORD = WMTRANS.PARENT_RECORD "
strSQL = strSQL & "AND ((WMORDER.WM_STATUS=18) AND (WMTRANS.WT_NOMCC= ""GUM"" ))"
SQLGUMCURR = strSQL
End Function
During my testing I had Remd out everything except SELECT, the first field, FROM one table, and I still got the error.
The parameter StartD is not used in this SQL string, but it is in others as a criterion to set the earliest WM.INVOICE_DATE
John
Bookmarks