[RESOLVED] Need help for search by comboBox
I have a Access (mdb) file containing fiedls Name, Father, Mother, Regd, Contact i connected with with vb6
in vb form there is a text1 textbox for search record from above fields and
to select category to search i put a comboBox (containing list Name, Father, Mother, Regd, Contact)
I am using this command to search record from field :
Data1.Refresh
Data1.RecordSource = "select * from table1 where table1.NAME like '" & Text1.Text & "*'"
This command search record from name field,
i want that when combo1 change the field of search from name to Father, mother or ID etc.
How can i do it, plz create and attach vb example if anybody has
Thanks in advance.
Re: Need help for search by comboBox
Something like this? Change Combo1 to whatever your combobox name is.
Code:
Data1.RecordSource = "select * from table1 where table1." & Combo1.Text & " like '" & Text1.Text & "*'"
I am assuming your combobox contains the field names you need
Re: Need help for search by comboBox
Quote:
Originally Posted by
LaVolpe
Something like this? Change Combo1 to whatever your combobox name is.
Code:
Data1.RecordSource = "select * from table1 where table1." & Combo1.Text & " like '" & Text1.Text & "*'"
I am assuming your combobox contains the field names you need
THANKS A LOT..... This is the easiest code that i was expected....