Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Query Hangs or Slow Performance after 2 updates

Hello,

I have an MS Query that will hang reading data after
performing the following steps 2 times:

1. Changed the CommandText statement to retrieve new data
2. Called the Refresh Method

Sometimes the data will read if I wait for a few minutes,
but other times Excel seems to have locked up entirely.
This only happens after I have performed the above steps
twice. However, if I close the workbook (the query has
been saved and is being reused), the query works when I
reopen it.

I have tried different data sources (created a new Access
DB and used that), but it still gives the same results.
The only thing I have noticed is that their is a join in
the query. If I am querying from only 1 table, then
there isn't any problem.

Is there some way to reset the connection/recordset or
whatever it is that Excel does when it closes the file?

Thanks,

Malcolm
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Query Hangs or Slow Performance after 2 updates

Hard to say without seeing code but sounds like it might
be a "cleanup" issue. Open your connection, command, and
recordset, do what you have to do, close the connection
and recordset, and then set all of them to Nothing.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Query Hangs or Slow Performance after 2 updates

I'd agree that it might be a cleanup issue. However, I
am using MS Query (Get External Data) in Excel, so it
does not seem I have access to those objects.

Here is my code to generate the query:

*** Begin Code ***

strBCQ2 = "SELECT PS_BC.Parent_Part,
PS_BC.Component_Part, PS_BC.Qpa, IPL_BC.Qty_On_Hand,
IPL_BC.Bin_Code FROM PS_BC INNER JOIN IPL_BC ON
PS_BC.Component_Part = IPL_BC.ID WHERE
((PS_BC.Parent_Part='" & PartNum(0) & "') OR
(PS_BC.Parent_Part='" & PartNum(1) & "')) AND
(IPL_BC.Bin_Code Is Null OR IPL_BC.Bin_Code<'B')"

Sheets("wsQUERY").QueryTables("BCQ2").CommandText =
strBCQ2

Sheets("wsQUERY").QueryTables("BCQ2").Refresh

*** End Code ***

The "PartNum" array was used to input 2 part numbers from
the user. Like I said before, I can only do this twice
before it will lock up. I have noticed that if I pull
data from only one table (and hence, there is no JOIN)
then it will run fine as many times as I desire.


-----Original Message-----
Hard to say without seeing code but sounds like it might
be a "cleanup" issue. Open your connection, command,

and
recordset, do what you have to do, close the connection
and recordset, and then set all of them to Nothing.

.

  #4   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default Query Hangs or Slow Performance after 2 updates

Make sure your join and filtering fields are properly
indexed (i.e. - IPL_BC.ID, PS_BC.Parent_Part, and
IPL_BC.Bin_Code).
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
Excel 2007 Slow Performance Danny Boy Excel Discussion (Misc queries) 0 January 28th 09 11:24 PM
Excel performance running slow juliejg1 Excel Discussion (Misc queries) 5 December 18th 07 10:08 PM
excel file performance slow inenewbl Excel Discussion (Misc queries) 2 April 25th 07 01:30 PM
Very slow performance while exploring. Gargoyl Excel Discussion (Misc queries) 1 April 24th 06 08:51 AM
Spreadsheet performance is slow Kristi Excel Worksheet Functions 7 January 5th 06 03:17 PM


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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"