Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 271
  • Last Modified:

SQL Query Syntax Error

Hello.

I need to make a dynamic query to RSMain based on the RSIndex id_indexador. But its not working this way...

Please help!

Thanks in advance!

comando = "SELECT * FROM tbl_Indexador" 
call abrers(comando, "listar", RSIndex)
 
DO WHILE NOT RSIndex.EOF 
comando = "SELECT * FROM tbl_Cotacao where dt_cotacao = '"&dt&"' and id_indexador = "& RSIndex("id_indexador")
call abrers(comando, "listar", RSMain&RSIndex("id_indexador"))
RSIndex.MoveNext
loop

Open in new window

0
drix76
Asked:
drix76
  • 2
1 Solution
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
what about combining this into 1 query:
comando = "SELECT * FROM tbl_Cotacao where dt_cotacao = '"&dt&"' and id_indexador IN ( select id_indexador FROM tbl_Indexador ) "
call abrers(comando, "listar", RSIndex)

Open in new window

0
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
apart from that: what error do you get, on which line, etc ..?
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now