If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Creating ODBC link within SELECT statement
Hi Preacher Man,
Please don't cross-post to multiple newsgroups. This bit of code sets a connection to Northwind on my local server Sub UpdatePivot() Dim pvt As PivotTable Dim pCache As PivotCache Dim sSQL, sServer, sUser As String Set pvt = PivotTables(1) Set pCache = pvt.PivotCache ' write a SQL query sSQL = "SELECT Orders.* FROM master.dbo.Orders Orders" ' select the server and login sServer = "EDSLAP" sUser = "sa" ' log in as sa, will ask for pwd pCache.CommandText = sSQL pCache.Connection = "ODBC; DRIVER=SQL SERVER;" _ & "SERVER=" & sServer & ";" _ & "UID=" & sUser & ";" _ & "APP=Microsoft Office 2003" pCache.Refresh End Sub Ed Ferrero Microsoft Excel MVP http://www.edferrero.com Is this possible. To explain myself, here is my situation. I created an Excel Spreadsheet that uses an ODBC link to a SQL database. In order for anyone to use this file on their PC, that same ODBC link must be setup. Is their some code I can use within a Select Statement that will allow me to bypass having to create an ODBC on everyone's PC? Thanks. |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Visio Shortcuts | [email protected] | Visio | 1 | December 29th, 2006 12:28 AM |
NEED HELP! User-level security/SQL question | Matt Mcd | General Discussion | 0 | October 21st, 2005 07:27 PM |
Query with sub SELECT statement not allowing sum of a field | Pouty | Running & Setting Up Queries | 1 | June 22nd, 2005 01:02 PM |
Conversion | SVC | Worksheet Functions | 9 | February 28th, 2005 03:29 PM |
Specifying field's data type in select statement | Benjamin Pratt | Running & Setting Up Queries | 2 | January 7th, 2005 10:26 PM |