Combobox to filter fields in database?

716 views Asked by At

How can I get the fields shown on the database to change depending on what is selected on the combobox? enter image description here Thanks

1

There are 1 answers

0
Nocturnal On

many ways to do this but i guess bindingsource would be the easiest.

just bind the grid to your datasource using a Bindingsource

then u can filter like

MyBindingSource.Filter = "Forename = Walter"

so with your Combobox it should look like

MyBindingSource.Filter = "Forename = " & ComboBox1.SelectedValue & ""

and to clear the filter

MyBindingSource.RemoveFilter()