Hmm, that code does not conform to what I suggested that you do. Let me
state my understanding of the situation, for you to check and correct or
confirm:
+ cboModPartNum and cboModPartLoc are combo boxes.
+ lboModPartMod is a list box whose rowsource is dependent on the values
selected in cboModPartNum and cboModPartLoc.
+ lboModPartLoc and lboModEff are list boxes whose rowsources are, or should
be, dependend on the value selected in lboModPartMod.
+ There is code currently in the AfterUpdate events of the two combo boxes
to requery lboModPartLoc so that its list correctly reflects the the
selected values in the combo boxes. This works.
+ However, the other list boxes, lboModPartLoc and lboModEff, don't clear
when you do this. Instead, they keep the same lists they had when you last
selected an item in lboModPartMod. What you want is for these list boxes to
clear when you change the selected values in the combo boxes, until you next
select an item in lboModPartMod.
Assuming that's correct, change your code to the following:
'------ start of code (modified procedures only) -----
Private Sub cboModPartLoc_AfterUpdate()
Me.lboModPartMod.Requery
Me.lboModPartMod = Null
Me.lboModPartLoc.Requery
Me.lboModEff.Requery
End Sub
Private Sub cboModPartNum_AfterUpdate()
Me.lboModPartMod.Requery
Me.lboModPartMod = Null
Me.lboModPartLoc.Requery
Me.lboModEff.Requery
End Sub
Private Sub lboModPartMod_AfterUpdate()
Me.lboModPartLoc.Requery
Me.lboModEff.Requery
End Sub
'------ end of code -----
That assumes that you have set up the list boxes at design time with
rowsources that refer to the appropriate controls on the form for criteria.
I don't know what your CmdSearch button is for -- there was no mention of it
in your previous posts, but it looks like you tried some of the code I
suggested there, though that was not what I intended.
By the way, there is never any need to explicitly requery a combo or list
box after you set its RowSource property. Setting the RowSource property
automatically forces a requery.
--
Dirk Goldgar, MS Access MVP
www.datagnostics.com
(please reply to the newsgroup)