By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,422 Members | 1,615 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,422 IT Pros & Developers. It's quick & easy.

Search Engine in Access using VBA

P: 1
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
Jul 19 '10 #1
Share this Question
Share on Google+
1 Reply


NeoPa
Expert Mod 15k+
P: 31,438
First off, you lose the single-quotes ('), as these denote string data.

That said, LIKE is not valid for numerical data. You can use :
Expand|Select|Wrap|Line Numbers
  1. [Product-ID]=X
With variations on the "=" of "<>", ">", "<", ">=", "<=", etc.
You can also use :
Expand|Select|Wrap|Line Numbers
  1. [Product-ID] In(X,Y,Z)
or :
Expand|Select|Wrap|Line Numbers
  1. [Product-ID]=Between X And Y
Jul 20 '10 #2

Post your reply

Sign in to post your reply or Sign up for a free account.