Hello experts! Since I am a newbie in the Vb programming, I'm really eager to ask you about making a search code.
In my program, I have a textbox named txtCriteria.text, wherein the user inputs the title of the book they want to search. These are the objects I have in my form:


TextBoxes named:
1.)txtCriteria
2.) txtBook
3. txtAuthor
4.) txtIsbn
5.) txtCategory

6.) ADODC named:dtaBooks
7.) command button named: cmdSearch

I have already connected the Adodc (data control) to the table of the database named "Books" Under the 'Books' table are the fields 'Book_Title, Author, ISBN, and Category'

Now what I want to happen are the ff:

1.) In the txtCriteria.text, if the user inputs a letter, letters, or words then after the search button is clicked, all the title of books under the Book_Title field that are approximiately similar to the wordings and initial letter to the inputted text in the txtCriteria.text will be displayed in the txtBook.text. Using the data control navigation arrows, all the list of that searched books can be viewed. And all the corresponding information of that book( Book_Title,Author,ISBN, and Category) must be displayed to the other textboxes.

In other word:
a.) The Book_Title must be displayed in the txtBook.text
b.) The Author must be in the txtAuthor.text
c.) The ISBN must be in the txtIsbn.text
d.) The Category must be in the txtCategory.text

Example: If the user inputs 'Da', all the book title which starts 'Da' will be displayed together with their corresponding informations. The data control must be used as the navigator of the search results.

I have already a code for save, edit, delete, update and others but the only problem is the search code. I'm just a newbie in VB programming so I'm asking for your brilliant minds to help me.:icon_smile:

if you want to contact me, here's my cellphone number= 09303413211
Thanks, hoping for your positive response...

Sheina,

Please do not leave your personal contact details on the web. There are some nasty people out there that will use this information to your detriment or harm.

If you are using a data control use the following -

Data1.Recordset.FindFirst "YourFieldNameToSearchFrom ='" & txtSearch.Text & "'"

If Data1.Recordset.NoMatch Then 'No record found
MsgBox "Data not found"
    Else
Text2.Text = Data1.Recordset.Fields("Name") 'Record was found, display the data
End If

Read more on this control if you want to use statements "LIKE" etc when the user only enters DA in a textbox to show all the records in the field starting with DA.

http://www.vb6.us/tutorials/database-access-vb6-data-control-tutorial

This article has been dead for over six months. Start a new discussion instead.