I think I have been looking at this too long.

I have to run a query on a database and I believe I have a syntax error somewhere in the query. I have been staring at it too long to try to figure it out.

"SELECT M.BE, M.L_BE, M.SPGM_STSTD, M.L_SPGM, M.CAT, M.L_CAT, M.OCA, M.L_OCA, M.L2, M.ORGL1L5, M.L_L1L5, M.OBJECT, M.L_OBJ, M.CF M.Sum(EXPENDITURES_YTD)
 FROM SERVER.M M
 GROUP BY M.BE, M.L_BE,  M.SPGM_STSTD,  M.L_SPGM,  M.CAT,  M.L_CAT,  M.OCA,  M.L_OCA,  M.L2,  M.ORGL1L5,  M.L_L1L5,  M.OBJECT,  M.L_OBJ,  M.CF
 HAVING ((M.BE='60900101') OR (M.BE='60900202') OR (M.BE='60910310') OR (M.BE='60910506') OR (M.BE='60910604') OR (M.BE='60910708'))
 AND (M.DTECYC='06/30/13M') AND (M.CF<>'C') AND (M.L2<>'00' AND M.L2<>'83' AND M.L2<>'98' AND  M.L2<>'99') AND (M.CAT='040000')"
It pulls the fields above, sums the total of the Expenditures_YTD column for each item, and returns result. Or, at least, it is supposed to.

The VB code is fine, it works on other queries without the SUM part just fine, but in this one I have something wrong in the syntax.

Any help would be appreciated.