Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Two Bound Listboxes 1

Status
Not open for further replies.

cyndiee

Technical User
Aug 9, 2002
8
US
I have two listboxes that are bound to two recordsets. When the user selects an item from the first listbox, I use a setSQLText statement to filter the data in the second recordset to display in the second listbox. The first time I click on an item in the first listbox, the second listbox properly updates with the filtered "subset" of data from the setSQLText statement. If I make a different selection from the first listbox, it does not update the data in the second listbox again. Do I need a command to update the listbox? Here is the code for my first listbox, Name is the recordset for the second listbox:

Sub DivListbox_onchange()
Name.close
Division.moveAbsolute(DivListbox.selectedIndex+1)
Div = Division.fields.getValue("Divsn")
NameSQL = "SELECT Last, First, . . . WHERE (Division = N'" & Div & "') ORDER BY Last, First"
Name.setSQLText(NameSQL)
Name.open
End Sub

Thanks for any suggestions.
 
I think you need to use setSQLText in the Recordeset's onbeforeopen event

-pete
[sub]I just can't seem to get back my IntelliSense[/sub]
 
I figured this one out. I had to use Listbox.clear for the second listbox prior to opening the associated recordset.

Thanks.
 
Thank you very much for the information. The same problem has puzzled me and I have spent 3 days on it!! It now works with my application as well.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top