Results 1 to 4 of 4

Thread: Search Engine - VB6.0

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2001
    Posts
    1

    Cool

    Hello to all developers :-)


    I am developing small Dictionary. Yes, but I also have one problem or question. How can be SQL string changed to search not only one equal word. For example:

    If I insert 'car' it will display only one result word 'car'

    But I need also to find out words like: carrer, carnage ... that are already in my Access97 MDB file. So, how to build up string, that would display me all words like ' *car* '.


    At the moment I am using textbox for displaying search results ... also how to show more results inside textbox if my SQL string would provide me more results for one keyword?

    My code:


    ... ... ...

    strSQL = "PARAMETERS [SearchingWord] TEXT; " & _
    "SELECT * FROM Words WHERE " & _
    "Slo LIKE [SearchingWord]"

    ' Slo is one field inside table Words


    Set qd = db.CreateQueryDef("", strSQL)
    qd.SQL = strSQL


    On Error GoTo Errorpoint
    Set rs = qd.OpenRecordset(dbOpenForwardOnly)
    On Error GoTo 0

    ... ... ...

    Best regards, Leader

  2. #2
    Junior Member
    Join Date
    Jan 2001
    Posts
    27

    Search on sql

    Why don't you use the DBcombi box + sql.
    Use the combi box to find the car or carnage and the sql for the querry.

    for example select * from recordsource where fieldname = dbcombi.text


    Johan

  3. #3
    Lively Member
    Join Date
    Feb 2001
    Location
    NL
    Posts
    70
    You can also use a wildcard in your query for example add a %-sign to the end of your searchword:

    "SELECT * FROM Words WHERE " & _
    "Slo LIKE "Car%""

    Or if you would like to find words that containt car (not just begin with it) try:

    "SELECT * FROM Words WHERE " & _
    "Slo LIKE "%Car%""

    Goodluck
    Another Johan
    "Do, or do not. There is no 'try'. "
    - Yoda ('The Empire Strikes Back')
    __________________

  4. #4
    Frenzied Member Mega_Man's Avatar
    Join Date
    Mar 2001
    Location
    North of England, South-East of Iceland
    Posts
    1,067
    Your correct coding because you are using a varible from within VB would be :

    "SELECT * FROM Words WHERE " & _
    "Slo LIKE [%" & text1.text & "%]"

    Hope this helps
    Mega
    "If at first you don't succeed, then skydiving is not for you"

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