Code:
strsqlim2 = "SELECT tempq1.CLLI, tempq1.alarm_desc, Sum(tempq1.SumOfCountOfmicro) AS SumOfSumOfCountOfmicro FROM tempq1 GROUP BY tempq1.CLLI, tempq1.alarm_desc HAVING (((tempq1.CLLI)=" & "'" & strclli & "'" & ") AND ((tempq1.alarm_desc) like " & """*host to m*""" & "))"
Debug.Print strsqlim2
.CursorType = adOpenDynamic
.LockType = adLockOptimistic
.Open strsqlim2, cnxnim
If .BOF = False Then
lncount = !SumofSumOfCountOfmicro
Debug.Print !SumofSumOfCountOfmicro
Else
lncount = 0
result of debug.print strsqlim2...
SELECT tempq1.CLLI, tempq1.alarm_desc, Sum(tempq1.SumOfCountOfmicro) AS SumOfSumOfCountOfmicro FROM tempq1 GROUP BY tempq1.CLLI, tempq1.alarm_desc HAVING (((tempq1.CLLI)='MTRLPQ01') AND ((tempq1.alarm_desc) like "*host to m*"))
If I copy and paste the resulting string in a new query (sql view) the records come up properly. When I run in VBA, no records are found.
The problem appears to be the like operator at the end... if I use = instead of like, the vba sql string pulls records okay. I need to use the like operand though.
I'm thinking either the cursor type or lock type might be affecting, but don't know enough about that to know for sure.
Thanks in advance for any help with this one.
Al
Last edited: