John said:
If you are getting an Invalid Procedure error then
-- are you running this query in Access?
-- have you checked your references?
-- will you post the SQL of the query that you are trying to use?
The len of your item numbers should not generate an invalid procedure call
UNLESS you have an ItemNumber that consists solely of the Letters EA or CT.
Try the following, where the match is based on at least one character
followed by CT or EA.
SELECT ItemNumber
FROM YourTable
WHERE ItemNumber In (
SELECT Left(ItemNumber,Len(ItemNumber)-2)
FROM yourtable
WHERE ItemNumber LIKE "*?EA" OR ItemNumber LIKE "*?CT")
OR ItemNumber LIKE "*EA" OR ItemNumber LIKE "*CT"
WHERE ItemNumber Like "*?EA" or ItemNumber LIKE "*?CT"
Query is being run in Access
References in order are
Visual Basics fro Applications
Microsoft Access 11.0 Object Library
OLE Automation
Microsoft ActiveX Data Objects 2.1 Library
Microsoft DAO 3.6 Object Library
No refs marked as missing
No items that are jusr EA or CT but I do have a number of items
that are only one digit
I cut and pasted your code and put my table name in but I'm getting a
syntax error(missing operator). Code below:
SELECT ItemNumber
FROM ECNIMaster
WHERE ItemNumber In (
SELECT Left(ItemNumber,Len(ItemNumber)-2)
FROM ECNIMaster
WHERE ItemNumber LIKE "*?EA" OR ItemNumber LIKE "*?CT")
OR ItemNumber LIKE "*EA" OR ItemNumber LIKE "*CT"
WHERE ItemNumber Like "*?EA" or ItemNumber LIKE "*?CT"