'by Phil Tippit FUNCTION SoundEx ALIAS "SoundEx" _ ( BYVAL incoming AS STRING ) EXPORT AS STRING DIM i AS LONG, x AS LONG DIM sResult AS STRING DIM sChar AS STRING DIM sx AS STRING * 26 sx$ = "01230120022455012623010202" incoming = UCASE$(incoming) i&=1:x&=LEN(incoming) DO WHILE i& <= x& AND LEN(sResult) < 4 ' will exit on null and length 4 sChar = MID$(incoming,i&,1) IF sChar =>"A" AND sChar =<"Z" THEN IF sResult = "" THEN sResult = sChar ELSE sChar=MID$(sx$,ASC(sChar)-64,1) IF sChar > "0" THEN IF LEN(sResult) < 2 THEN sResult=sResult+sChar ELSEIF RIGHT$(sResult, 1) <> sChar THEN sResult = sResult + sChar END IF END IF END IF END IF INCR i& LOOP FUNCTION = LEFT$(sResult + "0000", 4) END FUNCTION