Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 32
Default Listbox Clears Itself

Hi!

I have a listbox on a sheet that is populated using an ODBC query to a
SQLserver. The user selects two dates from calendar controls to form the
query. The query is performed, and the listbox listfillrange is set to the
query table resultrange.

Next, the user makes selections from the listbox (MultiSelectMulti,
ListStyleOption),
and clicks a command button. This button goes through the selected items,
and refreshes another ODBC querytable, modifying the where clause based on
the selected item in the listbox.

This all works well, except when the second query returns no rows. In this
case, all of the user's selections in the listbox are cleared. Why? I
stepped through the code - the selections are fine up to the refresh, then
get cleared. If all of the subsequent querytable refreshes return data, the
selections remain intact.

Does anyone have any suggestions as to what I should be looking at in order
to determine what is clearing the listbox selections? Thanks!


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 32
Default Listbox Clears Itself

Ok, I still don't know why this problem occurs, but a workable workaround is
to move the second querytable to a different sheet. When it returns no rows,
the listbox selections remain intact and I can continue to loop through the
listbox, executing the second qt.refresh based on listbox.selected(n) = true.
The problem was that when the second query cleared the listbox, my loop was
ending prematurely.

"MikeT" wrote:

Hi!

I have a listbox on a sheet that is populated using an ODBC query to a
SQLserver. The user selects two dates from calendar controls to form the
query. The query is performed, and the listbox listfillrange is set to the
query table resultrange.

Next, the user makes selections from the listbox (MultiSelectMulti,
ListStyleOption),
and clicks a command button. This button goes through the selected items,
and refreshes another ODBC querytable, modifying the where clause based on
the selected item in the listbox.

This all works well, except when the second query returns no rows. In this
case, all of the user's selections in the listbox are cleared. Why? I
stepped through the code - the selections are fine up to the refresh, then
get cleared. If all of the subsequent querytable refreshes return data, the
selections remain intact.

Does anyone have any suggestions as to what I should be looking at in order
to determine what is clearing the listbox selections? Thanks!


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
Formatting clears on opening ProbTim1 Excel Discussion (Misc queries) 1 March 21st 07 07:58 PM
Moving section of cells clears instead!? Don Wiss Excel Programming 1 March 23rd 05 01:49 PM
Worksheet_SelectionChange clears clipboard - can I stop this? ned Excel Programming 0 June 9th 04 07:02 PM
Really Need Help: side effect clears clipboard!!! Bura Tino Excel Programming 3 February 28th 04 12:44 PM
listbox.value not equal to listbox.list(listbox.listindex,0) ARB Excel Programming 0 October 22nd 03 12:46 AM


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