Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Run Time 1004 Error: Application or Object Difine Error | Excel Programming | |||
Error 1004, Application-definded or object-defined error | Excel Programming | |||
run-time error '1004': Application-defined or object-deifined error | Excel Programming | |||
Excel 2003 Macro Error - Runtime error 1004 | Excel Discussion (Misc queries) |