Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Syntax error in SQL statement 1

Status
Not open for further replies.

jadams0173

Technical User
Feb 18, 2005
1,210
I'm trying to use this SQL string in VBA. I am getting a syntax error. I've never used a statement this complex before. Could someone help me out with this please...Thanks

Code:
sqlMonday= "SELECT qryCommits.F1, qryCommits.MONDAYCOMMIT, Count(qry_NewDailyWip.SFCNUMBER) AS SFCsInWip, (Count([SFCNUMBER])-[MonDAYCommit])*[ATTR] AS NeedToWave, IIf(IsNull([waveprocess]),"NOT WAVED",[waveprocess]) AS Wave, (Abs([BOM_WC_TOOL_WAVE_ONLY]![WCT_SEC/BRD]*(Count([SFCNUMBER])-[MonDAYCommit])*[ATTR])) AS [WaveCycleTime(SEC/BRD)], IIf(IsNull([MaxofQuantity]),0,([MaxOfQUANTITY])*3600) AS [GateCycleTime_(SEC/CRD)], IIf(Count([SFCNUMBER])>=[MondayCommit],'N','Y') AS [YN], (Abs([WaveCycleTime(SEC/BRD)]))/3600 AS RunTime, IIf(IsNull([YIELD]),85,[YIELD]) AS NEWYIELD, ((100-[NEWYIELD])/100)+1 AS ATTR, BOM_WC_TOOL_WAVE_ONLY.[WCT_SEC/BRD], BOM_WC_TOOL_WAVE_ONLY.[letter] " _
         & " FROM (((qryCommits LEFT JOIN qry_NewDailyWip ON qryCommits.F1 = qry_NewDailyWip.F1) LEFT JOIN QRY_Gating_operation AS QRY_Gating_operation_1 ON qryCommits.F1 = QRY_Gating_operation_1.F1) LEFT JOIN BOM_WC_TOOL_WAVE_ONLY ON qryCommits.F1 = BOM_WC_TOOL_WAVE_ONLY.PARENT) LEFT JOIN QRY_UNIQUE_YIELD_WITH_REV ON qryCommits.F1 = QRY_UNIQUE_YIELD_WITH_REV.ITEM" _
         & " GROUP BY qryCommits.F1, qryCommits.MONDAYCOMMIT, IIf(IsNull([waveprocess]),"NOT WAVED",[waveprocess]), IIf(IsNull([MaxofQuantity]),0,([MaxOfQUANTITY])*3600), IIf(IsNull([YIELD]),85,[YIELD]), BOM_WC_TOOL_WAVE_ONLY.[WCT_SEC/BRD], BOM_WC_TOOL_WAVE_ONLY.letter" _
         & " HAVING (((IIf(Count([SFCNUMBER]) >= [MondayCommit], "N", "Y")) = "Y"))
 
Replace this (2 times):
,"NOT WAVED",
By this:
,'NOT WAVED',
And this:
& " HAVING (((IIf(Count([SFCNUMBER]) >= [MondayCommit], "N", "Y")) = "Y"))
By this:
& " HAVING Count([SFCNUMBER]) < [MondayCommit]"

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top