PDA

Click to See Complete Forum and Search --> : Searching using the record source property


Paul D
Jun 13th, 2000, 07:24 PM
Using DAO it is possible to search/update the contents of a DBGrid by linking the recordsource of a data control object to an unbound text box such as,

txtsearch on Change()

data1.RecordSource = "SELECT * FROM Customer WHERE Surname like " & """" & txtsearch.text & "*"""

bla bla etc etc

the DBGrid is of course is bound to Data1.

How is this method possible in ADO ?? I have tried different ways but get a message saying I can't change the source whilst the connection is open.

Can anybody help me ??

Jimmer
Jun 13th, 2000, 11:29 PM
Instead of using the data controller for ADO I have been just setting the grid equal to a defined recordset.

Like this:

Set tempRcSet = ("Select * From [table]",dbConnect,....)
set grid.Datasource = temprcset

This seems to allow me to change the recordset or recordsource without an error.

Are You using the OLE Grid as well?? Because this may be causing your problem.

Hope this helps.