ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Refresh spreadsheet from database through ODBC (https://www.excelbanter.com/excel-programming/337073-refresh-spreadsheet-database-through-odbc.html)

Souris

Refresh spreadsheet from database through ODBC
 
I put a spreadsheet on our web server.
The spreadsheet refresh the data while opening.
The data source from MS Access and the Access application execute a stroed
procedure from SQL server through ODBC.

It refreshes the data if user's machine has ODBC DSN to connect my database.

Is it required to have ODBC DSN on user's machine to refresh spreadsheet
from SQL server database?


Any information is great appreciated,



xydata

Refresh spreadsheet from database through ODBC
 
You don't need the DSN if you build what you need in the connection
string. Here's an example using ODBC to another Excel file.

With Selection.QueryTable
.Connection =
("ODBC;DBQ=C:\Blah;DefaultDir=C:\Blah;Driver={Micr osoft Excel Driver
(*.xls)};Extensions=xls;")
.Sql = ("SELECT blah blah blah" & _
"FROM `C:\Blah\Blah`.`Sheet1$` `Sheet1$`")
.Refresh BackgroundQuery:=False
End With

Try recording adding a query and it should build your connection
string.

Good luck

tlxl

Souris wrote:
I put a spreadsheet on our web server.
The spreadsheet refresh the data while opening.
The data source from MS Access and the Access application execute a stroed
procedure from SQL server through ODBC.

It refreshes the data if user's machine has ODBC DSN to connect my database.

Is it required to have ODBC DSN on user's machine to refresh spreadsheet
from SQL server database?


Any information is great appreciated,




All times are GMT +1. The time now is 11:12 AM.

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