ERRO DE SINTAXE - OPERDOR FALTANDO
sSql = [Ô] Select fi.empcod, fi.ficdat, fi.evecod, fi.ficmes, sum(fi.ficval) as valor, st.setcod, st.setdes from FICHA as fi [Ô]
sSql = sSql & [Ô] inner join funciona fu on fu.empcod = fi.empcod and fu.funpro = fi.funpro and [Ô]
sSql = sSql & [Ô] inner join setor st on st.setcod = fu.setcod [Ô]
sSql = sSql & [Ô] where fi.empcod = [ô][Ô] & cmbEmpCod.Text & [Ô][ô] and fi.ficmes = [ô][Ô] & MskMesAno.Text & [Ô][ô] and [Ô]
sSql = sSql & [Ô] fi.evecod in ([ô][Ô] & Chk0011 & [Ô][ô], [ô][Ô] & Chk0021 & [Ô][ô], [ô][Ô] & Chk0051 & [Ô][ô], [ô][Ô] & Chk0021 & [Ô][ô],[ô][Ô] & Chk0051 & [Ô][ô], [ô][Ô] & Chk0061 & [Ô][ô], [ô][Ô] & Chk1001 & [Ô][ô], [Ô]
sSql = sSql & [Ô] [ô][Ô] & Chk1011 & [Ô][ô], [ô][Ô] & Chk1021 & [Ô][ô], [ô][Ô] & Chk1031 & [Ô][ô], [ô][Ô] & Chk1051 & [Ô][ô], [ô][Ô] & Chk1061 & [Ô][ô], [ô][Ô] & Chk1211 & [Ô][ô], [ô][Ô] & Chk1331 & [Ô][ô] , [Ô]
sSql = sSql & [Ô] [ô][Ô] & Chk1501 & [Ô][ô], [ô][Ô] & Chk1511 & [Ô][ô], [ô][Ô] & Chk1611 & [Ô][ô], [ô][Ô] & Chk2001 & [Ô][ô], [ô][Ô] & Chk2111 & [Ô][ô], [ô][Ô] & Chk2301 & [Ô][ô], [ô][Ô] & Chk2361 & [Ô][ô], [Ô]
sSql = sSql & [Ô] [ô][Ô] & Chk2371 & [Ô][ô], [ô][Ô] & Chk2381 & [Ô][ô], [ô][Ô] & Chk4001 & [Ô][ô], [ô][Ô] & Chk4041 & [Ô][ô], [ô][Ô] & Chk4221 & [Ô][ô], [ô][Ô] & Chk4821 & [Ô][ô], [Ô]
sSql = sSql & [Ô] [ô][Ô] & Chk5101 & [Ô][ô], [ô][Ô] & Chk5501 & [Ô][ô], [ô][Ô] & Chk5521 & [Ô][ô], [ô][Ô] & Chk5551 & [Ô][ô], [ô][Ô] & Chk5561 & [Ô][ô], [ô][Ô] & Chk5571 & [Ô][ô], [ô][Ô] & Chk5601 & [Ô][ô], [Ô]
sSql = sSql & [Ô] [ô][Ô] & Chk5691 & [Ô][ô], [ô][Ô] & Chk5881 & [Ô][ô], [ô][Ô] & Chk6001 & [Ô][ô], [ô][Ô] & Chk6021 & [Ô][ô], [ô][Ô] & Chk6031 & [Ô][ô], [ô][Ô] & Chk6121 & [Ô][ô], [Ô]
sSql = sSql & [Ô] [ô][Ô] & Chk6271 & [Ô][ô], [ô][Ô] & Chk7041 & [Ô][ô], [ô][Ô] & Chk7291 & [Ô][ô], [ô][Ô] & Chk7301 & [Ô][ô], [ô][Ô] & Chk7331 & [Ô][ô], [ô][Ô] & Chk7351 & [Ô][ô], [Ô]
sSql = sSql & [Ô] [ô][Ô] & Chk7381 & [Ô][ô], [ô][Ô] & Chk7521 & [Ô][ô], [ô][Ô] & Chk8071 & [Ô][ô], [ô][Ô] & Chk8081 & [Ô][ô], [ô][Ô] & Chk8091 & [Ô][ô]) [Ô]
sSql = sSql & [Ô] group by fi.empcod, fi.evecod, fi.ficdat, fi.ficmes, fi.ficval, st.setcod, st.setdes order by fi.evecod [Ô]
Set rsProv = DBConn.Execute(sSql)
Citação:sSql = sSql & [Ô] inner join funciona fu on fu.empcod = fi.empcod and fu.funpro = fi.funpro and [Ô]
sSql = sSql & [Ô] inner join setor st on st.setcod = fu.setcod [Ô]
De acordo com o codigo acima, sua consulta está terminando com um AND e na sequência ta dando um INNER JOIN. Acho que isso não é permitido. Retire esse AND e testa.
Por exemplo: Tu pode eliminar a parte que contém o IN e o GROUP BY e ver se a consulta retorna alguma coisa. Se retornar, é porque o erro está na parte do comando IN e do Group By.
Citação:sSql = [Ô] Select fi.empcod, fi.ficdat, fi.evecod, fi.ficmes, sum(fi.ficval) as valor, st.setcod, st.setdes from FICHA as fi [Ô]
sSql = sSql & [Ô] inner join funciona fu on fu.empcod = fi.empcod and fu.funpro = fi.funpro [Ô]
sSql = sSql & [Ô] inner join setor st on st.setcod = fu.setcod [Ô]
sSql = sSql & [Ô] where fi.empcod = [ô][Ô] & cmbEmpCod.Text & [Ô][ô] and fi.ficmes = [ô] [Ô] & MskMesAno.Text & [Ô] [ô] [Ô]
Set rsProv = DBConn.Execute(sSql)
Se funcionar, aà você coloca o group by pra ver se retorna alguma coisa, assim:
Citação:sSql = [Ô] Select fi.empcod, fi.ficdat, fi.evecod, fi.ficmes, sum(fi.ficval) as valor, st.setcod, st.setdes from FICHA as fi [Ô]
sSql = sSql & [Ô] inner join funciona fu on fu.empcod = fi.empcod and fu.funpro = fi.funpro [Ô]
sSql = sSql & [Ô] inner join setor st on st.setcod = fu.setcod [Ô]
sSql = sSql & [Ô] where fi.empcod = [ô][Ô] & cmbEmpCod.Text & [Ô][ô] and fi.ficmes = [ô] [Ô] & MskMesAno.Text & [Ô] [ô] [Ô]
sSql = sSql & [Ô] group by fi.empcod, fi.evecod, fi.ficdat, fi.ficmes, fi.ficval, st.setcod, st.setdes order by fi.evecod [Ô]
Set rsProv = DBConn.Execute(sSql)
Se funcionar, o erro está somente no comando IN.
Coloque um parenteses pra ver se vai: sSql = sSql & [Ô] (inner join setor st on st.setcod = fu.setcod) [Ô]
from ( FICHA fi [Ô]
sSql = sSql & [Ô] inner join funciona fu on fu.empcod = fi.empcod and fu.funpro = fi.funpro )[Ô]
sSql = sSql & [Ô] inner join setor st on st.setcod = fu.setcod [Ô]
Agradeço pela ajuda