C
confused
Can someone please tell me what is wrong with this code. I get and
error " syntax error missing operator"
I can run this in the analyzer without a problem.
strSQL = "INSERT INTO TBL_PROG_Timekeepers " & _
"( MATT_CLASS_CODE, TRAN_TYPE, LEAD_CODE, LEAD_NAME, " & _
" MATTER_CODE, MATTER_NAME, PERIOD, EMPLOYEE_CODE, EMPLOYEE_NAME,
" & _
"WriteOffs, TXT1, Markdowns, CLIENT_CODE, Reason_desc,
Trans_date ) " & _
"SELECT HBM_MATTER.MATT_CLASS_CODE, " & _
" 'FM' AS TRAN_TYPE, HBM_PERSNL_1.EMPLOYEE_CODE, " & _
"HBM_PERSNL_1.EMPLOYEE_NAME, " & _
"HBM_MATTER.MATTER_CODE, " & _
"HBM_MATTER.MATTER_NAME, " & _
"BLH_BILLED_FEES.PERIOD, " & _
"p.EMPLOYEE_CODE, p.EMPLOYEE_NAME, " & _
"SUM(0) AS Writeoffs,ACT_TEXT.txt1, " & _
"SUM(BLH_BILLED_FEES.BILLED_AMT - BLH_BILLED_FEES.BASE_AMT) AS
Markdowns, " & _
"HBM_MATTER.CLIENT_CODE, " & _
"TAL_ADJ.ADJ_DESC, ACT_TRAN.Trans_date "
strSQL = strSQL + "FROM BLH_BILLED_FEES INNER JOIN " & _
"HBM_MATTER ON BLH_BILLED_FEES.MATTER_UNO = HBM_MATTER.MATTER_UNO
" & _
"INNER JOIN HBM_PERSNL as p ON HBM_MATTER.RESP_EMPL_UNO =
p.EMPL_UNO " & _
"INNER JOIN ACT_TRAN ON BLH_BILLED_FEES.SOURCE_TRAN_UNO =
ACT_TRAN.TRAN_UNO " & _
"INNER JOIN ACT_TEXT ON ACT_TRAN.TRANS_TEXT_ID = ACT_TEXT.TEXT_ID
" & _
"INNER JOIN HBM_PERSNL HBM_PERSNL_1 ON p.EMPL_UNO =
HBM_PERSNL_1.EMPL_UNO " & _
"INNER JOIN BLT_BILL ON ACT_TRAN.TRAN_UNO = BLT_BILL.TRAN_UNO " &
_
"INNER JOIN TAL_ADJ ON BLT_BILL.TIME_ADJ_CODE = TAL_ADJ.ADJ_CODE "
& _
"LEFT JOIN ACL_REASON ON ACT_TRAN.REASON_CODE =
ACL_REASON.REASON_CODE " & _
"GROUP BY HBM_MATTER.MATT_CLASS_CODE, " & _
"HBM_PERSNL_1.EMPLOYEE_CODE, HBM_PERSNL_1.EMPLOYEE_NAME, " & _
"HBM_MATTER.MATTER_CODE, " & _
"HBM_MATTER.MATTER_NAME, " & _
"BLH_BILLED_FEES.PERIOD, BLH_BILLED_FEES.period, " & _
"ACT_TEXT.txt1, HBM_MATTER.CLIENT_CODE, TAL_ADJ.ADJ_DESC,
ACT_TRAN.Trans_date, " & _
"p.EMPLOYEE_NAME, p.EMPLOYEE_CODE " & _
"HAVING BLH_BILLED_FEES.PERIOD >= " & txtFromPeriod & " " & _
" AND BLH_BILLED_FEES.PERIOD <= " & txtToPeriod & " " & _
" AND (SUM(BLH_BILLED_FEES.BILLED_AMT - BLH_BILLED_FEES.BASE_AMT)
<> 0) " & _
" AND HBM_MATTER.CLIENT_CODE <>'9999' " & _
" AND HBM_MATTER.CLIENT_CODE <> '9901' "
error " syntax error missing operator"
I can run this in the analyzer without a problem.
strSQL = "INSERT INTO TBL_PROG_Timekeepers " & _
"( MATT_CLASS_CODE, TRAN_TYPE, LEAD_CODE, LEAD_NAME, " & _
" MATTER_CODE, MATTER_NAME, PERIOD, EMPLOYEE_CODE, EMPLOYEE_NAME,
" & _
"WriteOffs, TXT1, Markdowns, CLIENT_CODE, Reason_desc,
Trans_date ) " & _
"SELECT HBM_MATTER.MATT_CLASS_CODE, " & _
" 'FM' AS TRAN_TYPE, HBM_PERSNL_1.EMPLOYEE_CODE, " & _
"HBM_PERSNL_1.EMPLOYEE_NAME, " & _
"HBM_MATTER.MATTER_CODE, " & _
"HBM_MATTER.MATTER_NAME, " & _
"BLH_BILLED_FEES.PERIOD, " & _
"p.EMPLOYEE_CODE, p.EMPLOYEE_NAME, " & _
"SUM(0) AS Writeoffs,ACT_TEXT.txt1, " & _
"SUM(BLH_BILLED_FEES.BILLED_AMT - BLH_BILLED_FEES.BASE_AMT) AS
Markdowns, " & _
"HBM_MATTER.CLIENT_CODE, " & _
"TAL_ADJ.ADJ_DESC, ACT_TRAN.Trans_date "
strSQL = strSQL + "FROM BLH_BILLED_FEES INNER JOIN " & _
"HBM_MATTER ON BLH_BILLED_FEES.MATTER_UNO = HBM_MATTER.MATTER_UNO
" & _
"INNER JOIN HBM_PERSNL as p ON HBM_MATTER.RESP_EMPL_UNO =
p.EMPL_UNO " & _
"INNER JOIN ACT_TRAN ON BLH_BILLED_FEES.SOURCE_TRAN_UNO =
ACT_TRAN.TRAN_UNO " & _
"INNER JOIN ACT_TEXT ON ACT_TRAN.TRANS_TEXT_ID = ACT_TEXT.TEXT_ID
" & _
"INNER JOIN HBM_PERSNL HBM_PERSNL_1 ON p.EMPL_UNO =
HBM_PERSNL_1.EMPL_UNO " & _
"INNER JOIN BLT_BILL ON ACT_TRAN.TRAN_UNO = BLT_BILL.TRAN_UNO " &
_
"INNER JOIN TAL_ADJ ON BLT_BILL.TIME_ADJ_CODE = TAL_ADJ.ADJ_CODE "
& _
"LEFT JOIN ACL_REASON ON ACT_TRAN.REASON_CODE =
ACL_REASON.REASON_CODE " & _
"GROUP BY HBM_MATTER.MATT_CLASS_CODE, " & _
"HBM_PERSNL_1.EMPLOYEE_CODE, HBM_PERSNL_1.EMPLOYEE_NAME, " & _
"HBM_MATTER.MATTER_CODE, " & _
"HBM_MATTER.MATTER_NAME, " & _
"BLH_BILLED_FEES.PERIOD, BLH_BILLED_FEES.period, " & _
"ACT_TEXT.txt1, HBM_MATTER.CLIENT_CODE, TAL_ADJ.ADJ_DESC,
ACT_TRAN.Trans_date, " & _
"p.EMPLOYEE_NAME, p.EMPLOYEE_CODE " & _
"HAVING BLH_BILLED_FEES.PERIOD >= " & txtFromPeriod & " " & _
" AND BLH_BILLED_FEES.PERIOD <= " & txtToPeriod & " " & _
" AND (SUM(BLH_BILLED_FEES.BILLED_AMT - BLH_BILLED_FEES.BASE_AMT)
<> 0) " & _
" AND HBM_MATTER.CLIENT_CODE <>'9999' " & _
" AND HBM_MATTER.CLIENT_CODE <> '9901' "