I have created a form that displays fields from a table. I've done this using an ADO controller that has its connection string as Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Users\...\database.mdb;Persist Security Info=False. And it has the recordsource of "SELECT * FROM Employees".

Then I've created text boxes that have this ado controller as a data source and then then refer to the fields, standard.

What I want to do it on the click of a button change the recordsource of the ado controller so that it will display different records...I want to change the recordsource to "SELECT * FROM Employees WHERE Name LIKE ""%" & txtEmpSearch.Text & "%"";"

I can enter this recordsource in manually and the form loads and shows the correct records, but nothing happens when running the following code from a button:

Private Sub cmdSearch_Click()
adoEmployee.RecordSource = "SELECT * FROM Employees WHERE Name LIKE ""%" & txtEmpSearch.Text & "%"";"
End Sub


It appears the recordsource is unchanged....what do I need to do here? Somehow reload the form? How? If I am going about this the wrong way what do I need to do?



Thanks very much in advance.