I created a VB6 program which I linked to MS-Access(.mdb) using AdoData Control. I created a Data Report which displays all the records in the table.
Now, I want to be able to FILTER any desired record (e.g anybody with a particular FIRSTNAME ) . This means, any time I want to display the records of those with FIRSTNAME = JOHN then I will type JOHN in a textbox control and filter their records alone in the Data Report.
I need your help to achieve this!!!!!!!!!!!
This is very very urgent
Thanks for your concern
Thanks for your Quick Reply
But using Where LNAME = 'JOHN' will limit the query to always retrieve LNAME with JOHN.
I want a dynamic situation whereby I may want to retrieve any LNAME and not just JOHN
I need a situation whereby as I type any LNAME in the textbox control on my FORM and click a button (e.g cmdFilter) then it will filter the LNAME so that the Data Report can also display the same filtered records and not all the records in the table.
Well, you simply include the contents of the textbox within the query string like
Code:
"... WHERE LNAME='" & txtName.Text & "'"
If txtName.Text would contain Henry then the query string would look like
SELECT .... WHERE LNAME='Henry'
The actual name being packed between single quotes.
Bookmarks