I am making a QueryTable in Excel and ran into this error.
I set query command text so
and get Run-time error 13 type mismatch. However when I run same query directly in access it doesnt cause any problems. What am I doing wrong and what is the remedy?
I set query command text so
Code:
.CommandText = Array("SELECT TOP 50 regn1,name, count (*) AS Counter_agents, sum(obk_sum) AS OBK, sum(obk_sum)*count(*) FROM (SELECT regn1, regn2, sum(obk) as obk_sum FROM kp0407 WHERE (BAL =31302 OR BAL=31303 or bal=31301) GROUP BY regn1, regn2 having sum(obk)>0), banc GROUP BY regn1,name;")
and get Run-time error 13 type mismatch. However when I run same query directly in access it doesnt cause any problems. What am I doing wrong and what is the remedy?