Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 310
Default Runtime Error .Refresh

I have the folloing code it worked fine up till today and now it gives me a
Runtime Error and when I debug it goes to the .Refresh BackgroundQuery: =
False line of the following code.

Sub Update()
Dim stAppName As String
stAppName = "H:\common\count\Update.bat"
Call Shell(stAppName, 1)

Sheets("Master").Visible = True
Sheets("Master").Select
Range("A1:AK5000").Select
Selection.ClearContents
Range("A1").Select
With ActiveSheet.QueryTables.Add(Connection:= _
"ODBC;DSN=dBASE
Files;DefaultDir=H:\common\count;DriverId=533;MaxB ufferSize=2048;PageTimeout=5;" _
, Destination:=Range("A1"))
.CommandText = Array( _
"SELECT INMTINFO.IN_INMNUM, INMTINFO.IN_NAME, INMTINFO.IN_RACE,
INMTINFO.IN_CSLR, INMTINFO.IN_CUSLVL, INMTINFO.IN_STATUS,
INMTINFO.IN_BIRTHDT, INMTINFO.IN_RELIGIO, INMTINFO.IN_FACRCVD,
INMTINFO.IN_DOCR" _
, _
"CVD, INMTINFO.IN_RCVDFAC, INMTINFO.IN_EFFDATE, INMTINFO.IN_SNTCLAS,
INMTINFO.IN_MINDATE, INMTINFO.IN_MAXDATE, INMTINFO.IN_MINSNT,
INMTINFO.IN_MAXSNT, INMTINFO.IN_CMTCNTY, INMTINFO.IN_OFFENSE, INMTINFO" _
, _
".IN_PERMLOC, INMTINFO.IN_LOCDESC, INMTINFO.IN_BLDING,
INMTINFO.IN_SECTION, INMTINFO.IN_CELLDRM, INMTINFO.IN_BEDNUM,
INMTINFO.IN_HONOR, INMTINFO.IN_PRIMPGP, INMTINFO.IN_WA1, INMTINFO.IN_WA1STRT,
INMTIN" _
, _
"FO.IN_WA1CS, INMTINFO.IN_MEDSTR, INMTINFO.IN_MEDEND,
INMTINFO.IN_CRESSTR, INMTINFO.IN_CRESEND, INMTINFO.IN_DAOFF,
INMTINFO.IN_SEXOFF, INMTINFO.IN_CNAME" & Chr(13) & "" & Chr(10) & "FROM
INMTINFO INMTINFO" _
)
.Name = "Query from dBASE Files"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = True
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.PreserveColumnInfo = True
.Refresh BackgroundQuery:=False
End With

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Runtime Error .Refresh

Well, to begin with, you are setting the Background query to both TRUE and
FALSE.

.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True<-----------------------here
.RefreshStyle = xlInsertDeleteCells
.SavePassword = True
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.PreserveColumnInfo = True
.Refresh BackgroundQuery:=False <----------------and here

Set either the .Backgroundquery property to TRUE or FALSE or , on the
..Refresh just add TRUE or FALSE - .Refresh False.

"Michelle" wrote:

I have the folloing code it worked fine up till today and now it gives me a
Runtime Error and when I debug it goes to the .Refresh BackgroundQuery: =
False line of the following code.

Sub Update()
Dim stAppName As String
stAppName = "H:\common\count\Update.bat"
Call Shell(stAppName, 1)

Sheets("Master").Visible = True
Sheets("Master").Select
Range("A1:AK5000").Select
Selection.ClearContents
Range("A1").Select
With ActiveSheet.QueryTables.Add(Connection:= _
"ODBC;DSN=dBASE
Files;DefaultDir=H:\common\count;DriverId=533;MaxB ufferSize=2048;PageTimeout=5;" _
, Destination:=Range("A1"))
.CommandText = Array( _
"SELECT INMTINFO.IN_INMNUM, INMTINFO.IN_NAME, INMTINFO.IN_RACE,
INMTINFO.IN_CSLR, INMTINFO.IN_CUSLVL, INMTINFO.IN_STATUS,
INMTINFO.IN_BIRTHDT, INMTINFO.IN_RELIGIO, INMTINFO.IN_FACRCVD,
INMTINFO.IN_DOCR" _
, _
"CVD, INMTINFO.IN_RCVDFAC, INMTINFO.IN_EFFDATE, INMTINFO.IN_SNTCLAS,
INMTINFO.IN_MINDATE, INMTINFO.IN_MAXDATE, INMTINFO.IN_MINSNT,
INMTINFO.IN_MAXSNT, INMTINFO.IN_CMTCNTY, INMTINFO.IN_OFFENSE, INMTINFO" _
, _
".IN_PERMLOC, INMTINFO.IN_LOCDESC, INMTINFO.IN_BLDING,
INMTINFO.IN_SECTION, INMTINFO.IN_CELLDRM, INMTINFO.IN_BEDNUM,
INMTINFO.IN_HONOR, INMTINFO.IN_PRIMPGP, INMTINFO.IN_WA1, INMTINFO.IN_WA1STRT,
INMTIN" _
, _
"FO.IN_WA1CS, INMTINFO.IN_MEDSTR, INMTINFO.IN_MEDEND,
INMTINFO.IN_CRESSTR, INMTINFO.IN_CRESEND, INMTINFO.IN_DAOFF,
INMTINFO.IN_SEXOFF, INMTINFO.IN_CNAME" & Chr(13) & "" & Chr(10) & "FROM
INMTINFO INMTINFO" _
)
.Name = "Query from dBASE Files"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = True
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.PreserveColumnInfo = True
.Refresh BackgroundQuery:=False
End With

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
xpath error? Runtime Error 13 type mismatch Steve M[_2_] Excel Discussion (Misc queries) 0 January 17th 08 01:16 AM
Runtime error '1004' General ODBC error star_lucas New Users to Excel 0 August 29th 05 04:09 PM
Excel 2003 Macro Error - Runtime error 1004 Cow Excel Discussion (Misc queries) 2 June 7th 05 01:40 PM
Interior class error/runtime error 1004 David Goodall Excel Programming 1 October 24th 04 10:16 PM
Syntax Error Runtime Error '424' Object Required sjenks183 Excel Programming 1 January 23rd 04 09:25 AM


All times are GMT +1. The time now is 08:52 PM.

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"