Thread: VBA & SQL
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
DMoney DMoney is offline
external usenet poster
 
Posts: 130
Default VBA & SQL

I do this dail -- just assign the values to a variable and include the
variable name between '" & variable & "' in the SQL statement

strsql = "SELECT xxx FROM yyyyyyyy" _
& "WHERE sssss='" & ActiveCell.Offset(columnoffset:=-5) & "'

"Excel interacting dinamically to SQL Srv" wrote:

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