Incremental Search (aka "Searching List Box"

DataMiner

Registered User.
Local time
Today, 11:01
Joined
Jul 26, 2001
Messages
336
For years I have been using the Incremental Search class module documented in my Access bible (The Access 2002 Desktop Developer's Handbook by Litwin, Getz, Gunderloy). Now that I am upgrading to Access 2007, this doesn't seem to work anymore. I don't get any error messages, it just doesn't do anything.

Searching on line turned up this article titled "Making a Searching Listbox in Access 2207"
http://msdn.microsoft.com/en-us/library/dd644811.aspx
I downloaded the code, and whoopee! It works just fine and seems much simpler than the previous version.

However, it does NOT work unless the listbox multiselect property is set to "none". In this case, no error messages are generated, and stepping through the code, all looks normal. It just doesn't select anything in the list box.

I need my listbox to be multiselect=extended.

Any ideas appreciated.

Thanks!
 
It doesn't look like the code in the URL you posted is geared towards a multiselect list box (and hence the simpler code). In your database, did you check for any missing references? What troubleshooting efforts did you try on your original code? Perhaps you could post the database (with any sensitive data removed) and we can have a look at it?
 
The problem was that the code, indeed, is not set up to handle a multiselect listbox. Once I edited it to handle multiselect, it works fine. In fact, I found my notes on the original code, and way back then I had had to edit it in the same way.
 
Glad to hear that you worked it out; good luck with your project.
 
"Making a Searching Listbox in Access 2207"

Wow! Access 2207! I guess that proves the rumors about Access being on the way to be false! :D
 
The problem was that the code, indeed, is not set up to handle a multiselect listbox. Once I edited it to handle multiselect, it works fine. In fact, I found my notes on the original code, and way back then I had had to edit it in the same way.

How did you get this to work? Thanks
 
worm,

What are you trying to do with the information that is selected in the multiselect list box? Depending on what you want to do will impact the code.
 
Hi

Its used as input for a report. That all works fine but the supplier list is so long that being able to jump to the first one required would save time tho usually single ones are selected. .Thanks
 
So the reports are generated for each supplier selected from the list box? If so then you would include the supplier name and their respective primary key value (hidden) in the list box. The code would then gather those primary key values into a string that could then be used as a filter for the report. This code snippet would get the primary key values in a string. The "submit" is the name of the list box. The Me. is just a shortcut that refers to the current form.

Code:
dim lngloop as long
dim strIDs as string

If Me.submit.ItemsSelected.Count <> 0 Then
    
        If Me.submit.ItemsSelected.Count > 0 Then
            For lngLoop = 0 To Me.submit.ItemsSelected.Count - 1
            If lngLoop = 0 Then
            strIDs = strIDs & Me.submit.ItemData(Me.submit.ItemsSelected(lngLoop))
            Else
            strIDs = strIDs + "," & Me.submit.ItemData(Me.submit.ItemsSelected(lngLoop))
            End If
            Next lngLoop
        
        End If
    End If
 
For years I have been using the Incremental Search class module documented in my Access bible (The Access 2002 Desktop Developer's Handbook by Litwin, Getz, Gunderloy). Now that I am upgrading to Access 2007, this doesn't seem to work anymore. I don't get any error messages, it just doesn't do anything.

Searching on line turned up this article titled "Making a Searching Listbox in Access 2207"

I downloaded the code, and whoopee! It works just fine and seems much simpler than the previous version.

However, it does NOT work unless the listbox multiselect property is set to "none". In this case, no error messages are generated, and stepping through the code, all looks normal. It just doesn't select anything in the list box.

I need my listbox to be multiselect=extended.

Any ideas appreciated.

Thanks!

Many thanks for your reply. The code to create a report form selections in the list box already works fine. Its the ansewer to the OP original question i would like info on. How to make the search box work when set to simple or extended.

Thanks
 
You want to open the report filtered by the selections made in the listbox?
 
That already works fine. I can select the items in the list and all reports run fine. I just want the search box for the list to work when list box is set to simple. If it is set to none any selection in the search box is found in the list. When it is set to simple/extended the search box doesnt work. There must be some change to the search box code that allows it work
 

Users who are viewing this thread

Back
Top Bottom