[AccessD] Listbox Issue - Selected Property or ListIndex persisting after requery

Bill Benson bensonforums at gmail.com
Fri Mar 14 20:20:56 CDT 2014


John, what does the class module code for your clsList look like? Does the
below come close? I am uncertain whether declaration of the collection
belongs inside the class or in a public module. I would think inside the
class otherwise what is the point... but I do remember in most of my work
with class modules adding the class itself to a public collection to
guarantee its persistence as long as VBA is not reset. I think I am
confused about different reason to use the collection, which might be why I
doubted you earlier that code was conserved.

Option Explicit
Option Compare Database

Public With Events clsList as Listbox
Private mcolDependents as New Collection

Public Sub  mDependentObj (objList as Listbox)
     mcolDependents.Add objList
End Sub

Private Sub clsList_AfterUpdate()
Dim objList as Object
For Each objList in mcolDependents
     objList.Requery
Next
End Sub

I don't follow your code below. Maybe your email editor added a space
before the .mDependentObj ?

>     clsCboClass .mDependentObj clsCboTeam
>   clsCboTeam .mDependentObj clsCboTeamPeople
>


More information about the AccessD mailing list