Search Engine in Access using VBA

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Arthurr
    New Member
    • Jul 2010
    • 1

    Search Engine in Access using VBA

    I have an Access database linked from SQL server and I need to create a search engine using VBA.

    I managed to create search engine for varchar items, but I cant make it to search numbers as well.
    I have a table called Product, with a field Product-ID.
    The field defined as Int and all the data is sequential numbers from 1 and on.
    How can I alter the statement:
    [Product Name] LIKE '%" & search & "%'
    so it will search from [Product-ID] ?

    Thanks a lot
  • NeoPa
    Recognized Expert Moderator MVP
    • Oct 2006
    • 32653

    #2
    First off, you lose the single-quotes ('), as these denote string data.

    That said, LIKE is not valid for numerical data. You can use :
    Code:
    [Product-ID]=X
    With variations on the "=" of "<>", ">", "<", ">=", "<=", etc.
    You can also use :
    Code:
    [Product-ID] In(X,Y,Z)
    or :
    Code:
    [Product-ID]=Between X And Y

    Comment

    Working...