ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   using SQL against Excel tables (https://www.excelbanter.com/excel-programming/418059-using-sql-against-excel-tables.html)

TAD from DBL

using SQL against Excel tables
 
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








--
Please contact me by email if you have an answer to this question. I
appreciate it.

RB Smissaert

using SQL against Excel tables
 
Have a look at my reply in this thread:

http://groups.google.co.uk/group/mic...7bc1fa333007ec

RBS


"TAD from DBL" .(donotspam) wrote in message
...
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








--
Please contact me by email if you have an answer to this question. I
appreciate it.




All times are GMT +1. The time now is 03:00 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com