Rob Brown
May 8th, 2000, 06:57 PM
Hi,
I'm using a DBGrid Control to represent information from a database and want to give the user a facility to filter the records.
The data control that the DBGrid uses as a datasource has a RecordSetTypeProperty of 0 (table).
I am using a combo box for the user to select a field to filter by and a text box for them to enter a value for that field.
The user then clicks on a command button in order to filter the records using the following SELECT statement:
dtaEditDatabase.RecordSource = "SELECT * FROM tblMain WHERE " & cboFilter.Text & " = '" & txtValue.Text & "';"
This does not produce an error (ie: Syntax error in SELECT statement)
However, my DBGrid control still displays all the records in the table.
How do I get it to show only the records from the new recordsource?
Any suggestions would be greatly appreciated.
Best Regards,
Rob Brown.
I'm using a DBGrid Control to represent information from a database and want to give the user a facility to filter the records.
The data control that the DBGrid uses as a datasource has a RecordSetTypeProperty of 0 (table).
I am using a combo box for the user to select a field to filter by and a text box for them to enter a value for that field.
The user then clicks on a command button in order to filter the records using the following SELECT statement:
dtaEditDatabase.RecordSource = "SELECT * FROM tblMain WHERE " & cboFilter.Text & " = '" & txtValue.Text & "';"
This does not produce an error (ie: Syntax error in SELECT statement)
However, my DBGrid control still displays all the records in the table.
How do I get it to show only the records from the new recordsource?
Any suggestions would be greatly appreciated.
Best Regards,
Rob Brown.