LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Help! Error 1004

Hi,

I'm trying to retrieve records from a SQL Server but continue to get ERROR
1004. I used the wizard as much as possible to create the following. I need
help with the syntax for Excel 2003.

Any help is appreciated

With ActiveSheet.QueryTables.Add(Connection:=Array(Arra y( _
"ODBC;DRIVER=SQL Native
Client;SERVER=LRD1CA99;UID=weholt;Trusted_Connecti on=Yes;APP=Microsoft Office
2003;WSID=HOLT-WESLEY-E;DATABASE" _
), Array("=AHD;")), Destination:=Range("L39"))
.CommandText = Array( _
"SELECT Top 25 pc.sym AS RequestArea, COUNT(*) As RATotal" & Chr(13)
& "" & Chr(10) & "From AHD.call_req cr INNER JOIN AHD.prob_ctg pc ON
pc.persid=cr.category" & Chr(13) & "" & Chr(10) & "WHERE
(call_req.zInitDtTm=" & startDate & " And call_req.zInitDtTm<=" & endDate &
") GROUP BY pc.sym ORDER BY RATotal DESC" _
)
.Name = "Query from test1"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.PreserveColumnInfo = True
.Refresh BackgroundQuery:=False
End With
 
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
Run Time 1004 Error: Application or Object Difine Error BEEJAY Excel Programming 0 October 17th 06 10:45 PM
Error 1004, Application-definded or object-defined error Mirco Wilhelm[_2_] Excel Programming 9 January 7th 06 04:56 PM
run-time error '1004': Application-defined or object-deifined error [email protected] Excel Programming 5 August 10th 05 09:39 PM
Excel 2003 Macro Error - Runtime error 1004 Cow Excel Discussion (Misc queries) 2 June 7th 05 01:40 PM


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

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"