using SQL against Excel tables

T

TAD from DBL

How can I just use SQL against tables right in Excel? Why won't something
like this work? Why would I have to open up a channel when I just want to
work with an excel table?

Dim Querystring As String
Dim DatabaseName As String
DatabaseName = "testtable"
QueryString = "SELECT * FROM testtable.field_three WHERE
(testtable.field_one="yes")"
Chan = SQLOpen(DNS??& testtable)
SQLExecQuery Chan, Querystring
Set Output = Worksheets("Sheet1").Range("A1")
SQLRetrieve Chan, Output, , , True
SQLClose Chan
End Sub
 

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

Top