Search for similar spellings

  • Thread starter Thread starter Andrew
  • Start date Start date
A

Andrew

I have a text box in a form that, when a string such
as "Smith" is entered it finds all records with "Smith" in
the 'Last Name' field. The trouble is that sometimes the
user may enter "Smiht" or "Smithe" by accident. How can I
make Access return words that are spelt almost the same as
well as those spelt the correct way? The table has
thousands of records and so I can't create a list of
alternative spellings.

Thanks!
 
I don't think you can. What logic would Access use? If two letters
anywhere in the word are transpossed? If a letter is missing? If an extra
letter was hit by mistake? If one letter was wrong? There are way too many
variables.

You could build a query to find uniqu last names only, sort it by the name
field, and have a user scan through the list and make corrections.


Rick B
 
Andrew,
I think your only real option is the LIKE function. Check it out in
Help. In your example...
Like "smi" & "*"
would have found "Smith"... and "Smiht" and "Smithe" as well.

Using the Like function allows users to decise how "exact" the search
will be.
Like "s" & "*" vs. Like "sm" & "*" vs. Like "smi" & "*" etc..
etc...
so... if they're not always sure of the spelling they can tighten or broaden
the search accordingly.

I wouldn't do much more than that. If you try to make a Find work
properly with incorrect input from users, you'll go nuts trying to "plug all
the holes in the dike."
No coding will ever successfully handle sloppy input. If they don't
input legitimate data, they can do it over. But... Like is a quick and
reasonable compromise.
hth
Al Camp
 
Andrew said:
I have a text box in a form that, when a string such
as "Smith" is entered it finds all records with "Smith" in
the 'Last Name' field. The trouble is that sometimes the
user may enter "Smiht" or "Smithe" by accident. How can I
make Access return words that are spelt almost the same as
well as those spelt the correct way? The table has
thousands of records and so I can't create a list of
alternative spellings.

Sadly Access and Windows in general lack Regular expressions which would
help.

You can use the Like function which will help.
If it's a big problem you could also use a Soundex algorithm in a calculated
field. As long as they get the first letter right and are close it will work
very well.
 
Back
Top