I have a strange situation with one of my ongoing developments. Briefly, I am passing a form control (almost always a ComboBox) as a parameter to a function in a class. The function scans the class, and loads entries that match a set of filters, into the list portion of the control. Naturally, one of the parameters is ClearList? - do you want to clear the list before starting. This allows two scans to piggybacked on top of each other.
When the ClearList parameter is set to true (the default) we call the .Clear method of the control, which clears the list (only) of the control, but leaves any text box (for a ComboBox) unaffected.
The problem is that sometimes the Clear operation doesn't work. In truth, I suspect that every time the Clear operation doesn't work, but the first time the list is already empty.
The method works fine in a less complex environment, but doesn't work when the control is addressed indirectly (the control is itself a parameter).
I'm using this as an incremental search and display as a search value is built - rather like the way in which Google puts suggestions in the results are as you type in your search term. The net result is that as the list should be getting shorter (we are approaching the definitive, unique search value) it actually seems to begetting longer, because the list isn't being cleared properly.
I have a lab tool where the calls are emulated by buttons on the console of the tool, and there is never any problem clearing the list.
I realize that this is tough to visualize from only a description, so I've attached the actual workbook, and also the lab tool.
The Actual workbook is LMS.- Library Management System. It installs in a directory, and produces two traces:
LMS-Library Management SYstem EVTrace.txt - a trace of the form events, as they fire
LMS-LibraryManagement System Trace.txt - a more detailed trace of activites - needs source code!
These two files are best printed in landscape format to pre3serve linear formatting.
To 'play' with the system, you'll need to load LMSForm, and run it using f5.
Tab to the Title combobox of the Books page (default page), and type in:
The Unan (just 8 characters)
The combobox list begins to show possibilities as you get past 4 characters, and then rather than eliminating poibilities (by clearing the list), the list becomes clogged with 'impossibilities'.
Use Exit to get out, and explore the trace files, and/or the source files.
The procedures of interest are the Change procedure of me.cboBookTitle, in LMSForm, and the function
LoadListControlEntries in the classclBook. I've extracted both procedures to a code box.
cboBookTitle_Change
Function LoadListControlEntries
LMS is too big to upload directly, so I've put it in a .zip file by itself.
The Labtool is in ComboBoxLab.xlsm, and the same method of activating it applies, as do the two trace files. This is really only a lab tool for me, but you should be able to explore it and see how thecombobox functions when prodded.
I'm now going out for a long walk!
Tony
Bookmarks