Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Excel - VBA - QueryTable error 1004

This code works fine with an Oracle database via ODBC.
But with SQL Server via OLEDB an 1004 error occurs : why ???

["xxx" replaces private data]

Dim qt As Excel.QueryTable
Dim strSQL As String
Dim strConnexion As String

strSQL = "SELECT Id, Libelle FROM Profil"
strConnexion = "Provider=sqloledb;Data Source=xxx.xxx.xxx.xxx;Initial
Catalog=xxx;User Id=xxx;Password=xxx"

Set qt = ActiveSheet.QueryTables.Add(Connection:=strConnexi on,
Destination:=ActiveSheet.Range("A1"), Sql:=strSQL)

The strConnexion has been generated by an UDL file.

Thanks.

Jacques.


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
Prevent error messagebox when refresing querytable from the web fails bzm New Users to Excel 13 January 17th 06 01:24 PM
Excel 2003 Macro Error - Runtime error 1004 Cow Excel Discussion (Misc queries) 2 June 7th 05 01:40 PM
VB6 and Excel - 1004 error news.easynews.com Excel Programming 0 June 20th 04 03:19 PM
Error 1004 in Excel 97... Mike[_81_] Excel Programming 3 May 2nd 04 03:37 AM
RunTime Error "1004" QueryTable is Invalid Devendra[_3_] Excel Programming 1 January 21st 04 11:01 AM


All times are GMT +1. The time now is 09:52 AM.

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

About Us

"It's about Microsoft Excel"