Solved

SQL Query Syntax Error

Posted on 2009-07-07
2
263 Views
Last Modified: 2013-11-16
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
Comment
Question by:drix76
  • 2
2 Comments
 
LVL 142

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 500 total points
ID: 24793335
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
 
LVL 142

Expert Comment

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

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article explains all about SQL Server Piecemeal Restore with examples in step by step manner.
Many companies are looking to get out of the datacenter business and to services like Microsoft Azure to provide Infrastructure as a Service (IaaS) solutions for legacy client server workloads, rather than continuing to make capital investments in h…
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

930 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now