Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Trouble creating DSN-less connection

Hi,

Im trying to get a connection to an Oracle database using Excel.
Following the advice on:

http://www.dicks-clicks.com/excel/Ex....htm#CreateVBA

I can get a successful connection using DSN. But I cannot seem to
connect without DSN. The following code generates an error 1004
(application-defines or object-defined error). Any pointers
appreciated. Thanks.

Sub CreateQT()

Dim sConn As String
Dim sSql As String
Dim oQt As QueryTable

'This connection string works
sConn = "ODBC;DSN=WCS;" & _
"UID=username;" & _
"PWD=password;" & _
"SERVER=server_name.world;"

'This connection string does not, Error 1004
'sConn = "Driver={Microsoft ODBC For Oracle};" & _
"Server=server_name.world;" & _
"Uid=username;" & _
"Pwd=password"

sSql = "SELECT * FROM SKU"

Set oQt = ActiveSheet.QueryTables.Add( _
Connection:=sConn, _
Destination:=Range("a1"), _
Sql:=sSql)

oQt.Refresh

End Sub

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Trouble creating table lindyq Excel Discussion (Misc queries) 0 February 24th 10 04:54 PM
trouble w/ creating a VBA function that uses an enum in it's parameters [email protected] Excel Programming 2 August 2nd 05 12:54 PM
having trouble creating chart to show monthly totals Ian Roberts Charts and Charting in Excel 2 June 5th 05 06:36 PM
Creating connection documents LAF[_5_] Excel Programming 0 September 22nd 04 08:32 PM
Creating connection documents LAF[_4_] Excel Programming 1 September 22nd 04 06:15 PM


All times are GMT +1. The time now is 10:05 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"