#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 32
Default Query Error

I get this error:
Run-time error '-2147417848 (80010108)

Automation error
The object invoked has disconnected from its clients

Here is my code. It crashes on the .Refresh BackgroundQuery:=False

Sub LoadAssays()
With ActiveSheet.QueryTables.Add(Connection:= _
"FINDER;\\Server1\data\Engineering\Assay.dqy", Destination:= _
Range("A1"))
.Name = "Assay"
.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
End Sub

Here is the situation. I run it once and it is fine. It loads everything
into a spreadsheet. I close the spreadsheet and then run it again and I get
this error. Do I need to 'close' the connection so I can re-establish it?
If so how do I do this.

Thanks a bunch, everyone here are a great help!
Chad


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,942
Default Query Error

hi,
this code adds a query. you need only to run it once.
after the query has been created all you have to do after that is refresh
the query.
i am quessing but i think that you get the error becasue you are trying to
create a new query on top of the old. and that is were the conflict occures.
try this

Sub RefreshQuery()
activesheet.range("A1").QueryTable.Refresh BackgroundQuery:=False
end sub

i always recommend that brackground query not be run perticularly if you are
going to be processing the data that the query is refreshing with more code.

regards
FSt1

"Chad" wrote:

I get this error:
Run-time error '-2147417848 (80010108)

Automation error
The object invoked has disconnected from its clients

Here is my code. It crashes on the .Refresh BackgroundQuery:=False

Sub LoadAssays()
With ActiveSheet.QueryTables.Add(Connection:= _
"FINDER;\\Server1\data\Engineering\Assay.dqy", Destination:= _
Range("A1"))
.Name = "Assay"
.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
End Sub

Here is the situation. I run it once and it is fine. It loads everything
into a spreadsheet. I close the spreadsheet and then run it again and I get
this error. Do I need to 'close' the connection so I can re-establish it?
If so how do I do this.

Thanks a bunch, everyone here are a great help!
Chad



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
web query error Vijay Kotian Excel Discussion (Misc queries) 0 September 11th 07 10:22 AM
MS Query error Ken W Excel Worksheet Functions 1 April 6th 06 04:08 PM
MS query error Ken W Excel Discussion (Misc queries) 0 March 30th 06 01:37 PM
error using MS query Ken W Excel Discussion (Misc queries) 0 March 6th 06 03:47 AM
Run-query error JohnDing[_2_] Excel Programming 3 December 1st 04 12:07 PM


All times are GMT +1. The time now is 03:05 AM.

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"