Results 1 to 4 of 4
  1. #1
    Join Date
    Jan 2004
    Location
    Toronto, Canada
    Posts
    259

    Unanswered: "Like" function in CODE

    trying to use Like function in ADO.

    Dim rec as adodb.recordset
    rec = new ad....

    rec.Open "SELECT fname.tablename from tablename WHERE fname LIKE '*" & comparisonname & "*';", conn, ad.....

    how come if i insert that SQL statement into a query line, it works fine (gives 1 result) but when i insert into code like above, it doesn't give any results? as in recordcount = 0.


    does the like function have different usage in code? or the "*" char?

  2. #2
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    Replace "*" with "%" ...
    Back to Access ... ADO is not the way to go for speed ...

  3. #3
    Join Date
    Jan 2004
    Location
    Toronto, Canada
    Posts
    259
    ah..*knock my head*..thx

  4. #4
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    Quote Originally Posted by Jerrie
    ah..*knock my head*..thx
    Keep this in mind: Use "*" when in the QBE. That is the WildCard. Use "%" when using ADO, DAO, etc ... (Even DoCmd.RunSQL ) ...
    Back to Access ... ADO is not the way to go for speed ...

Posting Permissions

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