Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 468
  • Last Modified:

Filter List Box from command button

Dear Experts

Using Access 2010 I am trying to produce an interactive demonstration of data to clients who are interested in staffing numbers and details across Europe.  Rather than using visio / power point I am using access so I can reuse this time and again with the end user simply producing excel spread sheets in the right format that get imported / linked into access.

I have produced a map which resides in a form, using transparent command buttons when the user clicks on a country a list box pops up with the names of their competitors.  That was the easy part - I am keen to apply a filter to the list box from that command button.  

The list box is called “Offices” and contains 2 fields:  “Company” and “Country”. (“Country” is hidden from view).  So for example when I click on Spain the list is filtered by all companies whose “Country” = “Spain”

Can anybody help?
1 Solution
Rey Obrero (Capricorn1)Commented:
in the click event of each button, place this

private sub btn_click()
me.offices.rowsource="select company,country from tablex where country=" & chr(34) & me.btn.caption & chr(34)

end sub
correlateAuthor Commented:
That's fantastic - thank you and thank you for a record breaking response

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now