VBA & SQL

  • Thread starter Thread starter Excel interacting dinamically to SQL Srv
  • Start date Start date
E

Excel interacting dinamically to SQL Srv

Hi folks,

I have a spreadsheet that queries a SQL Server. I would like to use the
values selected on some form controls as parameters to my queries. Eg: I will
query the server using in the where clause the values selected in a specific
listbox from the spreadsheet... the results will be showed in the same
spreadsheet in a destination pre-defined.

Did anybody do this before? Any hint or tip to help me?

Many thanks in advance and congratulations to every contributor that help to
make this community a high-level information source!

Leandro - BR
 
Hi dmoney,

I really appreciated your support but unfortunately I'm new to this stuff...

Could you please post the complete code, including the SQL connection, the
variable declaration and the defition of the destination?

It would help me a lot!

Thank you very much!

Cheers,
Leandro
 
There is a detail that makes that a little difficult...

The ListBox is MultiSelection enabled, so in the SQL Statement the WHERE
clause should be using the IN verb instead of equal to... how to do this? I'm
getting an error message because don't know how to use the '(' properly in
the statement.

Thanks!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top