Results 1 to 2 of 2

Thread: Search a database

  1. #1

    Thread Starter
    Hyperactive Member jlt7's Avatar
    Join Date
    Jan 2006
    Posts
    413

    Search a database

    I have a movie database program and in this program I have a treeview on it. I would like to have a search on it to search the database for movie name and select the closest one to what is entered into the search textbox and have the search button change to say find next and search more of the database until it has found no more then msgbox no more found. Also have it select the name in the treeview.

  2. #2
    Hyperactive Member
    Join Date
    Aug 2002
    Location
    UK
    Posts
    417

    Re: Search a database

    umm hi I know ho you can do this but at the moment I not got time to make an example for you how ever I took a pice of code I used in a program I made years ago that may help get you started,

    VB Code:
    1. Dim StrSql As String
    2. On Error Resume Next
    3.    
    4.     RecoredSet = "TestTable"
    5.    
    6.     StrSql = "SELECT Firstname,LastName,Age " & _
    7.     "FROM " & RecoredSet & " WHERE Firstname Like '*" & "Kevin" & "*'"
    8.    
    9.     Set Recored_Set = d_base.OpenRecordset(StrSql)
    10.     If Recored_Set.RecordCount = 0 Then SiteFound = False: Exit Function
    11.    
    12.     With Recored_Set
    13.         While Not Recored_Set.EOF
    14.             'This just loops tho and picks out any names
    15.             MsgBox !Firstname
    16.             MsgBox !LastName
    17.             .MoveNext
    18.         Wend
    19.     End With
    20.     Set Recored_Set = Nothing
    21.     StrSql = ""
    When your dreams come true.
    On error resume pulling hair out.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width