My own filter by form box (sorta)

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm seeing that the more questions I post, they progressively get harder. As
described in my last post I have two tables I'm concerned about. I have a
Personel table that contains related contact information for a person. I
also have a table called Sites. The relationship is a one to many meaning
more than one individual may be located at any single site.

Here's what I'd like to do. I have a Personel form. I'd like to add a drop
down list box that looks up the names of all the sites. When I click on a
site name in the drop down list box I want the recordset of the form to be
filtered by that site. So the form will only display information for people
located at that site. And then I'll have a button right next to it that says
remove filter and when clicked it will put the recordset back to normal where
all of the people are visible.

Maybe rather than changing the recordset, I should set the control source of
the form to a query. When the drop down list box is updated it changes the
query to filter based on site name and refreshes the form.

Let me know if I'm on the right path. At any rate, how would I modify the
recordset or a query based on a selected option in a drop down list box?
 
Allen,

That website worked wonders for me. Although I wish I could extend it's
capabilities slightly.

I use a list box(lstNames) to navigate records on my form. Essentially it
looks up it's values from a query that pulls all the employee's names. And
the AfterUpdate event of the Listbox causes the form to go to the record
associated with that employee.

I'd like to have this listbox somehow work inconjunction with this filter
combobox that I now have. When I filter my recordsource by using my
combobox, I'd like to have my Listbox display only those employees names in
the record source.

My guess is I need to add a line somewhere in my code that might look like
this:

Me.lstNames.rowsource = "Select Name from recordsource"

I tried this once but all I got was a blank list. Thanks again for the help
with the filter combobox.

Jonathan
 
Back
Top