Results 1 to 5 of 5

Thread: SQL problem

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2009
    Posts
    10

    SQL problem

    so basically ive got the following piece of SQL:

    "SELECT Scales.[Scale Name], Scales.[Root Note], Scales.Notes from Scales where (InStr(Scales.Notes, Text1.Text)"

    where text1 is a textbox on the form, yet it doesnt seem to register it, is there some special way to put text1.text into the InStr function?

  2. #2
    Addicted Member
    Join Date
    Jan 2007
    Posts
    143

    Re: SQL problem

    I don't believe an InStr function exists in SQL.

    If you're looking for the value of Text1.Text in Scales.Notes, why not try:

    "SELECT Scales.[Scale Name], Scales.[Root Note], Scales.Notes from Scales where Scales.Notes like '%" & Text1.Text & "%'"

    ?

  3. #3

    Thread Starter
    New Member
    Join Date
    Jul 2009
    Posts
    10

    Re: SQL problem

    Quote Originally Posted by dev.rogee View Post
    I don't believe an InStr function exists in SQL.

    If you're looking for the value of Text1.Text in Scales.Notes, why not try:

    "SELECT Scales.[Scale Name], Scales.[Root Note], Scales.Notes from Scales where Scales.Notes like '%" & Text1.Text & "%'"

    ?
    aha it works a beauty! thankyou very much!

    may i ask what the % denotes?

  4. #4
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: SQL problem

    Quote Originally Posted by CrownOfHorns View Post
    ...may i ask what the % denotes?
    The % symbol is a wild card. Similar to DOS' * symbol.
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  5. #5

    Thread Starter
    New Member
    Join Date
    Jul 2009
    Posts
    10

    Re: SQL problem

    Quote Originally Posted by LaVolpe View Post
    The % symbol is a wild card. Similar to DOS' * symbol.
    ahh that makes sense, i was using * instead of %
    cool thanks

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