![]() |
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 |
Help! Error 1004
Step throug the code and post the point at which this is failing.
Regards, Eddie http://www.HelpExcel.com |
Help! Error 1004
It Fails at this point
.Refresh BackgroundQuery:=False Thanks for the reply " wrote: Step throug the code and post the point at which this is failing. Regards, Eddie http://www.HelpExcel.com |
All times are GMT +1. The time now is 12:42 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com