Results 1 to 5 of 5
  1. #1
    Join Date
    Aug 2008
    Posts
    27

    Unanswered: Searching with an SQL Query

    Hi everyone

    I have a DB which contains songs. I want the user to be able to search for the song.

    With this mode:

    Like "*" & [Enter some text to find in the song name:] & "*"

    There seems to be a problem when searching for a song that includes punctuation?
    for example the song: "Can't Get You Out Of My Head" if you just search for "Cant get you" it doesn't find anything.

    Is there a way of using an SQL split function, then create the SQL based on the number of words found?

    I'm a bit of a novice in terms of SQL - so any help would be greatly appreciated!!

    Thanks!

  2. #2
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    Why another topic?

    Try this:

    Like """*" & [Enter some text to find in the song name:] & "*"""
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  3. #3
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926
    or this

    Like """ & [Enter Name of song:] & """"
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

  4. #4
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    Why use Like if you aren't going to use wildcards?
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  5. #5
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    You have to escape the apostrophes - you can either remove them, or double them up; something like


    Like Replace('*" & [Enter some text to find in the song name:] & "*', '''', '''''')"
    George
    Home | Blog

Posting Permissions

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