Like query IN vb and access

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • swagata
    New Member
    • Sep 2006
    • 5

    Like query IN vb and access

    hi...

    I am developing a library application using VB 6.0 As front end and Microsoft Access as Back end.

    I want to search by keywords and i have used the following SQL statement in VB

    "SELECT * From Daily_Book WHERE Bookname Like' "& Text1.Text & " ' %"

    Daily_Book is my table name and Bookname is the column name.
    I want to enter the keyword in Text1.Text (say C++) And search all books with C++ in the table Daily_Book

    I executed the above code ..it gives me syntax errors......
    Please help me..

    dolly
  • ADezii
    Recognized Expert Expert
    • Apr 2006
    • 8834

    #2
    Originally posted by swagata
    hi...

    I am developing a library application using VB 6.0 As front end and Microsoft Access as Back end.

    I want to search by keywords and i have used the following SQL statement in VB

    "SELECT * From Daily_Book WHERE Bookname Like' "& Text1.Text & " ' %"

    Daily_Book is my table name and Bookname is the column name.
    I want to enter the keyword in Text1.Text (say C++) And search all books with C++ in the table Daily_Book

    I executed the above code ..it gives me syntax errors......
    Please help me..

    dolly
    'This should do it
    "SELECT * From Daily_Book WHERE Bookname Like '" & Me![Text1] & "*'"

    Comment

    • PEB
      Recognized Expert Top Contributor
      • Aug 2006
      • 1418

      #3
      Yeah,

      It depends which syntax do you use in your database..

      ANSI 89 or ANSI 92

      ANSI 89 is with *
      ANSI 92 is with %

      Maybe your VB application was connected to SQL SERVER?

      :)

      Comment

      • swagata
        New Member
        • Sep 2006
        • 5

        #4
        Thnx every1...the problem got solved...:-)

        Comment

        Working...