I am using access 2003 and I am getting a having clause error. I believe one of the variables in the having clause is probably null. I tried to use ?proctot in the immediate window but nothing came up. I know how to trap for this error after the strSQL is created (If Not rstCPT.EOF ) but how can I resolve this error? I have highlighted the code causing the error in blue. Any help is appreciated.
Code:
strSQL = "SELECT cptdisplay,Max(cptdesc) as dsc " & _
"FROM PROC_RptSrc_CPTSumm_Chgs " & _
"HAVING ((Sum(proctot)+Sum(chg)) <> 0) " & _
"GROUP BY cptdisplay " & _
"ORDER BY cptdisplay;"
[Blue] Set rstCPT = CurrentDb.OpenRecordset(strSQL, dbOpenSnapshot)[/Blue]
If Not rstCPT.EOF Then
With rstCPT
.MoveLast
.MoveFirst
End With