Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default waiting Query result

Hi,
I've a query ...

Connstring =
"ODBC;DSN=simic;ArrayFetchOn=1;ArrayBufferSize=8;D BQ=simic;OpenMode=0;DecimalSymbol=,;ClientVersion= 8.10.117.017;CodePageConvert=1252"

Sqlstring = "SELECT CentriDiProfitto.CodCentroProfitto,
CentriDiProfitto.Descrizione "
Sqlstring = Sqlstring & "FROM CentriDiProfitto "
Sqlstring = Sqlstring & "WHERE (((CentriDiProfitto.Stato)<1)) "

With ActiveSheet.QueryTables.Add(Connection:=Connstring , _
Destination:=Worksheets("Commesse").Range("A1"), Sql:=Sqlstring)
.Refresh
End With

.....
.....

With Worksheets("Commesse")
.Visible = xlSheetVisible
.Select
.Cells.Copy
End With

With Worksheets("Commesse.tmp")
.Cells.PasteSpecial Paste:=xlPasteValues
.Select
.Range("A1").Select
End With

Worksheets("Commesse").Visible = xlSheetVeryHidden
.................................

After the query I copy the cells of "commesse" into "commesse.tmp" and I
hidden the sheet.
But the query has not terminate, and I copy only 1 o 2 row.

How I can wait the end of the query?







  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default waiting Query result

Hi Paolo,

See the BackgroundQuery propert in VBA help.

Try changing:

.Refresh


to

.Refresh BackgroundQuery:=False


---
Regards,
Norman



"Paolo9001" wrote in message
...
Hi,
I've a query ...

Connstring =
"ODBC;DSN=simic;ArrayFetchOn=1;ArrayBufferSize=8;D BQ=simic;OpenMode=0;DecimalSymbol=,;ClientVersion= 8.10.117.017;CodePageConvert=1252"

Sqlstring = "SELECT CentriDiProfitto.CodCentroProfitto,
CentriDiProfitto.Descrizione "
Sqlstring = Sqlstring & "FROM CentriDiProfitto "
Sqlstring = Sqlstring & "WHERE (((CentriDiProfitto.Stato)<1)) "

With ActiveSheet.QueryTables.Add(Connection:=Connstring , _
Destination:=Worksheets("Commesse").Range("A1"), Sql:=Sqlstring)
.Refresh
End With

....
....

With Worksheets("Commesse")
.Visible = xlSheetVisible
.Select
.Cells.Copy
End With

With Worksheets("Commesse.tmp")
.Cells.PasteSpecial Paste:=xlPasteValues
.Select
.Range("A1").Select
End With

Worksheets("Commesse").Visible = xlSheetVeryHidden
................................

After the query I copy the cells of "commesse" into "commesse.tmp" and I
hidden the sheet.
But the query has not terminate, and I copy only 1 o 2 row.

How I can wait the end of the query?









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
Importing result from Access query to Excel but the result only c. Edwin Excel Discussion (Misc queries) 0 March 16th 06 01:36 AM
put query result into variable andy[_6_] Excel Programming 1 October 24th 05 07:39 AM
Waiting for data to be returned from Microsoft Query bclakey Excel Discussion (Misc queries) 0 July 1st 05 12:36 AM
Waiting Mode when query data from Db via VBA! Microlong Excel Programming 4 February 18th 05 10:17 AM
Query result and formula Payal[_2_] Excel Programming 1 April 28th 04 09:25 PM


All times are GMT +1. The time now is 12:20 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"