From: De Jager on 13 Mar 2010 12:50
"Nathan D Clark" <NathanDClark(a)discussions.microsoft.com> wrote in message
>I am running Access 2007. I have two listboxes sitting side by side on the
> same form.
> One has phone number categories - lstCategories
> The second listbox has name, phone numbers - lstPhoneNumbers
> Both listboxes are unbound
> I had this working once where you could click the category in the first
> and it would filter the second listbox to the phone number in a different
> click category box select family, friend etc.
> the second box would only show numbers of family or category you selected
> the first box.
> Now, the boxes work perfectly fine as far as retrieving the data. The
> problem is the Requery code stopped working. I have to actually click a
> Refresh button to refresh after clicking the category.
> I have two copies of the same DataBase.
> On the original DB it works perfectly fine. The copy of this same DB will
> not requery after selection of the category. I am lost on why the code
> would stop working in the copy.
> Here is the code:
> Private Sub lstCategories_AfterUpdate()
> Me.lstPhoneNumbers = Null
> End Sub
> Here is the Row Source of the First list box - lstCategories
> SELECT [PhoneCategories].[PhoneCategory] FROM PhoneCategories ORDER BY
> Here is the Row Source of the Second listbox - lstPhoneNumbers
> SELECT Contacts.ContactID, (FirstName+" ") & LastName, PhoneNumber,
> FROM Contacts INNER JOIN ContactPhones ON
> Contacts.ContactID=ContactPhones.ContactID WHERE
> PhoneCategory=Form!lstCategories Or Form!lstCategories Is Null ORDER BY
> LastName, FirstName;