Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!
  1.   Become a Supporter    ::   Make a Contribution   
    Target (Recurring Monthly): $200 :: Achieved: $98

Re: Using Soundex

Discussion in 'Information Technology' started by D-A-M via AccessMonster.com, Oct 29, 2005.

Tags:
  1. D-A-M via AccessMonster.com

    D-A-M via AccessMonster.com
    Expand Collapse
    Guest

    Hi Alastair,

    I would really appriate if you could help me with this. I need to see all
    the companies that sound like "clients", so I wrote the following query:

    SELECT *
    FROM Contacts
    WHERE Company:- SoundCoce: Soundex("clients");

    I added the code to a module, but when I want to use the function the way you
    described I got an error. Perhaps I'm using the function in the wrong way.

    Could you please tell me how should I use the Soundex function?

    Thanks!
    Facu





    Alastair MacFarlane wrote:
    >Ivan,
    >
    >Soundex is a Class that I have altered to a public function you can use in
    >your query. Add the following code into a module and declare it in a query as
    >per my first reply.
    >
    >If you use this in the debug window you get the same Soundex code for a
    >different surname. I hope this helps.
    >
    >?MakeSoundexA("MacFarlane")
    >M2164
    >?MakeSoundexA("McFarlane")
    >M2164
    >
    >Option Compare Database
    >Option Explicit
    >
    >Public Function MakeSoundexA(From As String) As String
    > Dim Codes(25) As Byte
    > Dim PrevCode As Byte
    > Dim CurrentCode As Byte
    > Dim i As Integer
    > Dim j As Integer
    > Dim CurrentChar As Integer
    > Dim Soundx As String
    > Dim A As Byte
    > Dim Z As Byte
    > Codes(0) = 0
    > Codes(1) = 1
    > Codes(2) = 2
    > Codes(3) = 3
    > Codes(4) = 0
    > Codes(5) = 1
    > Codes(6) = 2
    > Codes(7) = 0
    > Codes(8) = 0
    > Codes(9) = 2
    > Codes(10) = 2
    > Codes(11) = 4
    > Codes(12) = 5
    > Codes(13) = 5
    > Codes(14) = 0
    > Codes(15) = 1
    > Codes(16) = 2
    > Codes(17) = 6
    > Codes(18) = 2
    > Codes(19) = 3
    > Codes(20) = 0
    > Codes(21) = 1
    > Codes(22) = 0
    > Codes(23) = 2
    > Codes(24) = 0
    > Codes(25) = 2
    > If (Len(From) = 0) Then
    > MakeSoundexA = ""
    > Exit Function
    > End If
    > Z = Asc("Z")
    > A = Asc("A")
    > Soundx = UCase$(Left$(From, 1))
    > PrevCode = Codes(Asc(Left$(Soundx, 1)) - Asc("A"))
    > i = 2
    > Do While (i <= Len(From)) And Len(Soundx) < 5
    > CurrentChar = Asc(UCase$(Mid$(From, i, 1)))
    > If (CurrentChar >= A And CurrentChar <= Z) Then
    > CurrentCode = Codes(CurrentChar - A)
    > If (CurrentCode <> 0) Then
    > If (CurrentCode <> PrevCode) Then
    > Soundx = Soundx & Format$(CurrentCode)
    > End If
    > End If
    > PrevCode = CurrentCode
    > End If
    > i = i + 1
    > Loop
    > Soundx = Left$(Soundx & "00000", 5)
    > MakeSoundexA = Soundx
    >End Function
    >
    >> I guess it's from Access 2003.
    >>

    >[quoted text clipped - 6 lines]
    >> >
    >> > When was that released and where can I get it? I'm still on Jet 4.0.
     
  2. Loading...


Since you're here... we have a small favor to ask...

More people are visiting & reading SPN than ever but far fewer are paying to sustain it. Advertising revenues across the online media have fallen fast. So you can see why we need to ask for your help. Donating to SPN's is vote for free speech, for diversity of opinions, for the right of the people to stand up to religious bigotry. Without any affiliation to any organization, this constant struggle takes a lot of hard work to sustain as we entirely depend on the contributions of our esteemed writers/readers. We do it because we believe our perspective matters – because it might well be your perspective, too... Fund our efforts and together we can keep the world informed about the real Sikh Sikhi Sikhism. If everyone who writes or reads our content, who likes it, helps us to pay for it, our future would be much more secure. Every Contribution Matters, Contribute Generously!

    Become a Supporter      ::     Make a Contribution     



Share This Page