Results 1 to 3 of 3

Thread: Better search

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Feb 2000
    Location
    CWMBRAN,WALES,UK
    Posts
    146
    This works fine, but relies on inputting the full name and correct spelling of the name.

    prompt = "Enter a name to search for"
    title = "NAME SEARCH"
    employee = InputBox(prompt, title)
    search = "Name = '" + employee + "'"

    ' Find the record
    Data1.Recordset.FindFirst (search)

    Could someone give me a (search =) line that assuming a name was joe bloggs would find the record if just "joe" or "bloggs" was entered.

    Any help appreciated

    GRAHAM

  2. #2
    PowerPoster BruceG's Avatar
    Join Date
    May 2000
    Location
    New Jersey (USA)
    Posts
    2,657
    Try this:

    search = "Name LIKE '*" & employee & "*'"

    Your FindFirst should then return the first record where the Name field contains the string that the user entered.

    P.S.: It is better to use & for concatenation.
    "It's cold gin time again ..."

    Check out my website here.

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Feb 2000
    Location
    CWMBRAN,WALES,UK
    Posts
    146
    Thanks Bruce, it works great.
    I had the first part of the statement right but I had
    & "*" instead of "*'"

    Thanks again

    GRAHAM

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