Thanks for the reply Bob, let me see if i can explain it a bit better.
I am trying to parse an output file from a PABX phone system. I have an MDB
file with aprox 200 prefixes which rance from 1-5 chars in length (eg:
country codes, national & local telephone codes).
as an example, an international number dialled might be: 001161290000000,
and this would correspond to the record '0011' (int. call prefix) in the
MDB file. yet a local number would be just 90000000, and correspond to the
record '9' as long as there is no record '90' etc. So you can see my dilemma
with length of strings.
It will always be an exact match, but i may have the strings "9" "90" and
"901", the number "9058321" would have to be matched to "90" in the
database and "921345" would have to match just "9".
I was thinking of a large IF statement starting with LEFT(string,5), if it
finds no match move on to LEFT,4 and etc all the way to 1.
Is there a better way? if not whats the best way of organising an if
statement that large?
Cheers,
John R.
"Bob Butler" <bu*******@earthlink.net> wrote in message
news:fa*************************@posting.google.co m...
he exmaple you give matches the first 4 digits of an 8-character code
against a field that is an exact match. That seems like a simple
query. You then say it can be 1-5 characters and you want the "best
match" but don't explain what the possible matches are or which would
be better than others... can you elaborate with some more examples
include good/better/best matches?