Excel Odbc Error 1004
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta run time error 1004 general odbc error in excel Discuss the workings and policies of this site About Us Learn more runtime error 1004 general odbc error about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack run time error 1004 general odbc error refresh backgroundquery false Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you,
Excel Error 1004 Application-defined Or Object-defined Error
helping each other. Join them; it only takes a minute: Sign up Excel 2010: Run time error 1004 general odbc error up vote 0 down vote favorite I have a small Excel 2010 query that either times out (not responding) then gets the error Run time error 1004 general odbc error When I debug it highlights this line: excel error 1004 macro Selection.QueryTable.Refresh BackgroundQuery:=False This was working in Excel 2007. I tried On Error Resume Next to get the query to skip any errors and move to the next part but that didn't help. Sub Refresh_all() Application.ScreenUpdating = False Application.Goto Reference:="querycell" Range("A2").Select Selection.QueryTable.Refresh BackgroundQuery:=False Dim pt As PivotTable Dim ws As Worksheet For Each ws In ActiveWorkbook.Worksheets For Each pt In ws.PivotTables pt.RefreshTable Next pt Next ws Application.Goto Reference:="returncell" Range("A1").Select Application.ScreenUpdating = True End Sub excel excel-vba excel-2010 share|improve this question edited Mar 18 '15 at 8:31 asked Feb 3 '15 at 10:10 Matt 7,549154482 Which line do you receive the error on? –Gareth Feb 3 '15 at 10:32 @Gareth ill try and get it to error again, but mostly it just times out (excel not responding). is there any syntax that isn't compatible in 2010? –Matt Feb 3 '15 at 10:46 Is it still timing out even if you remove the On Error Resume Next statement? Apart from that are you sure you are
have a little macro that queries an ACCESS file and returns desired values. The program works fine on my computer, but when my user tries to excel error 1004 method range of object _worksheet failed run it on his computer, (same versoion of Excel, 2000), he gets the
Excel Error 1004 Method Range Of Object _global Failed
following error. Run Time Error '1004' General ODBC Error Obviously some difference between the two machines, but who knows
Excel Error 1004 Select Method Of Range Class Failed
what to do to fix it? TIA Vaya con Dios, Chuck, CABGx3 CLR, Nov 7, 2008 #1 Advertisements Joel Guest It would help to know which line of code is failing. One http://stackoverflow.com/questions/28296258/excel-2010-run-time-error-1004-general-odbc-error thing to check is the error option in BA. go to VBA menu Tools - Options - General - Error Trapping. "CLR" wrote: > Hi All......... > I have a little macro that queries an ACCESS file and returns desired > values. The program works fine on my computer, but when my user tries to run > it on his computer, (same versoion of Excel, http://www.pcreview.co.uk/threads/run-time-error-1004-general-odbc-error.3666788/ 2000), he gets the following > error. > > Run Time Error '1004' General ODBC Error > > Obviously some difference between the two machines, but who knows what to do > to fix it? > > TIA > Vaya con Dios, > Chuck, CABGx3 > Joel, Nov 7, 2008 #2 Advertisements CLR Guest Hi Joel........ Thanks for the comeback..... Here's the code... With ActiveSheet.QueryTables.Add(Connection:=Array(Array( _ "ODBC;DSN=MS Access Database;DBQ=" & NewFile & ";DefaultDir= " _ ), Array( _ ";DriverId=281;FIL=MS Access;MaxBufferSize=2048;PageTimeout=5;" _ )), Destination:=Range("A1")) .CommandText = Array( _ "SELECT `NPR Database`.`Disposition Date`, `NPR Database`.`Inspection Date`, `NPR Database`.`NPR Origin`, `NPR Database`.`NPR Number`, `NPR Database`.`Part Number`, `NPR Database`.`Serial Number`, `NPR" _ , _ " Database`.`Vendor Code`, `NPR Database`.`Vendor Name`, `NPR Database`.`No of Defects`, `NPR Database`.`Qty RTV`, `NPR Database`.`Defect Description`, `NPR Database`.`Corrective Action`" & Chr(13) & "" & Chr(10) & "FROM `" _ , _ "" & newfile2 & "`.`NPR Database` `NPR Database`" & Chr(13) & "" & Chr(10) & "ORDER BY `NPR Database`.`Vendor Code`" _ ) .Name = "Query from MS Access Database" .FieldNames = True .RowNumbers = False .FillAdjacentFormulas = False .PreserveFormatting = True .RefreshOnFileOpen = False .BackgroundQuery = True .RefreshStyle = xlInsertDeleteCells .SavePas
Forums Excel Questions General ODBC Error - Run time error 1004 Results 1 to 10 of 10 General ODBC Error - Run time error 1004This http://www.mrexcel.com/forum/excel-questions/433755-general-odbc-error-run-time-error-1004-a.html is a discussion on General ODBC Error - Run time error 1004 within the Excel Questions forums, part of the Question Forums category; Please help me before this laptop becomes a Frisbee! I almost have this working but I'm getting stuck on this ... LinkBack LinkBack URL About LinkBacks Bookmark & Share Digg this Thread!Add Thread to del.icio.usBookmark in TechnoratiTweet error 1004 this thread Thread Tools Show Printable Version Display Linear Mode Switch to Hybrid Mode Switch to Threaded Mode Dec 3rd, 2009,12:58 PM #1 John Wood Board Regular Join Date Sep 2008 Location Ontario, Canada Posts 118 General ODBC Error - Run time error 1004 Please help me before this laptop becomes a Frisbee! I almost have this working but I'm getting stuck excel error 1004 on this error every time I execute it. I have an ODBC with read-only privileges and I recorded part of the code from the macro. The "from" and "to" date fields I added ( I think I'm correct). I would truly appreciate the help. Here's the code: Private Sub CommandButton1_Click() Dim smpldatea As Date Dim smpldateb As Date Dim fdate1 As String Dim fdate2 As String smpldatea = UserForm1.TextBox1.Text smpldateb = UserForm1.TextBox2.Text fdate1 = Format(smpldatea, "m/d/yyyy hh:mm:ss") fdate2 = Format(smpldateb, "m/d/yyyy hh:mm:ss") Sheets("Sheet1").Activate Range("A1:H10000").ClearContents With ActiveSheet.QueryTables.Add(Connection:=Array(Array( _ "ODBC;DRIVER={Oracle in OraHome92};SERVER=XXXXXX;UID=DT_I;PWD=RO2ACCESS;DBQ=XXXXXXP;DBA=W;APA=T;EXC=F;XSM=Default;FEN=T;QTO=T;FRC=10" _ ), Array( _ ";FDL=10;LOB=T;RST=T;GDE=F;FRL=Lo;BAM=IfAllSuccessful;MTS=F;MDI=Me;CSR=F;FWC=F;PFC=10;TLO=O;" _ )), Destination:=Range("A1")) .CommandText = Array( _ "SELECT DT_CENTERLINE_AUDIT.AUDIT_DATE, DT_CENTERLINE_AUDIT.CENTERLINE_ID, DT_CENTERLINE_AUDIT.COMPLIANT, DT_CENTERLINE_AUDIT.CORRECTED, DT_CENTERLINE_AUDIT.LINE, DT_CENTERLINE_AUDIT.LOCATION" & Chr(13) & "" & Chr(10) & "FROM DTD" _ , _ "BA.DT_CENTERLINE_AUDIT DT_CENTERLINE_AUDIT" & Chr(13) & "" & Chr(10) & "WHERE (DT_CENTERLINE_AUDIT.AUDIT_DATE>= '" & fdate1 & "' And DT_CENTERLINE_AUDIT.AUDIT_DATE<= '" & fdate2 & "') AND (DT_CENTERLINE_AUDIT.L" _ , "OCATION='0902')") .Name = "Query from YODA2_2" .FieldNames = True .RowNumbers = False .FillAdjacentFormulas = False .PreserveFormatting = True .RefreshOnFileOpen = False .BackgroundQuery = True .RefreshStyle = xlInsertDeleteCells .SavePassword = True .SaveData = True .AdjustColumnWidt