I am getting an error 3075 when ever my routine gets to this point in the program.
The whole error is Syntax error (missing operator) in query expression '(grpdsc1='CARITAS ST. ELIZABETH'S MED CTR') GROUP BY fydiff,rptpd,fymonord ORDER BY rptpd
I originally thought nulls could have caused this error. I checked the table PROC_RptSrc_ExecSumm and it has zeros in it but no nulls.
The error point is highlighted in blue
Any help is appreciated
Tom
The whole error is Syntax error (missing operator) in query expression '(grpdsc1='CARITAS ST. ELIZABETH'S MED CTR') GROUP BY fydiff,rptpd,fymonord ORDER BY rptpd
I originally thought nulls could have caused this error. I checked the table PROC_RptSrc_ExecSumm and it has zeros in it but no nulls.
The error point is highlighted in blue
Any help is appreciated
Tom
Code:
The original procedure
strSQL = "SELECT fydiff,rptpd,fymonord as fyord,Sum(proctot) AS prcs,Sum(chg) AS chgs,Sum(ca) AS cadj,Sum(wo) AS woff" & _
",Sum(pmt) AS pmts,Sum(dr) AS deb,Sum(ar) AS arec,Sum(arover90) AS ar90,Sum(last3chg) AS lst3 " & _
"FROM PROC_RptSrc_ExecSumm " & _
"GROUP BY fydiff,rptpd,fymonord " & _
"ORDER BY rptpd;"
Call ExecSumm_Grp_DataScript(iRw, strSQL)
Public Sub ExecSumm_Grp_DataScript(iBaseRw As Integer, strESSQL As String)
'*** THIS SUB ADDS THE SUB DATA TO A EXECUTIVE SUMMARY SECTION
Dim rstES As Recordset
Dim iESRec As Integer
' Add Data
[Blue] Set rstES = CurrentDb.OpenRecordset(strESSQL, dbOpenSnapshot) [/Blue]
If Not rstES.EOF Then
With rstES
.MoveLast
.MoveFirst
End With
For iESRec = 1 To rstES.RecordCount
If (rstES![fydiff] = 0) Then ' Current Year
With goXL.ActiveSheet
.Cells((rstES![fyord] + iBaseRw + 4), 3).Value = (rstES![prcs])
.Cells((rstES![fyord] + iBaseRw + 4), 4).Value = (rstES![chgs])
.Cells((rstES![fyord] + iBaseRw + 4), 6).Value = (rstES![cadj])
.Cells((rstES![fyord] + iBaseRw + 4), 7).Value = (rstES![woff])
.Cells((rstES![fyord] + iBaseRw + 4), 9).Value = (rstES![pmts])
.Cells((rstES![fyord] + iBaseRw + 4), 10).Value = (rstES![deb])
.Cells((rstES![fyord] + iBaseRw + 4), 15).Value = (rstES![arec])
.Cells((rstES![fyord] + iBaseRw + 4), 17).Value = (rstES![ar90])
.Cells((rstES![fyord] + iBaseRw + 4), 23).Value = (rstES![lst3])
End With
Else ' Prior Year
With goXL.ActiveSheet
.Cells((rstES![fyord] + iBaseRw + 4), 43).Value = (rstES![prcs])
.Cells((rstES![fyord] + iBaseRw + 4), 44).Value = (rstES![chgs])
.Cells((rstES![fyord] + iBaseRw + 4), 45).Value = (rstES![cadj])
.Cells((rstES![fyord] + iBaseRw + 4), 46).Value = (rstES![woff])
.Cells((rstES![fyord] + iBaseRw + 4), 47).Value = (rstES![pmts])
.Cells((rstES![fyord] + iBaseRw + 4), 48).Value = (rstES![deb])
.Cells((rstES![fyord] + iBaseRw + 4), 40).Value = (rstES![arec])
.Cells((rstES![fyord] + iBaseRw + 4), 42).Value = (rstES![ar90])
.Cells((rstES![fyord] + iBaseRw + 4), 39).Value = (rstES![lst3])
End With
End If
rstES.MoveNext
Next iESRec
End If
' Close Data
rstES.Close
Set rstES = Nothing
End Sub