[AccessD] FW: A2003: Checking for dupe phone numbers

Darren DICK d.dick at uws.edu.au
Sun Dec 5 20:52:55 CST 2004


 
Never mind -  found a function to do it
Dunno who wrote (wasn't me:-))
Apologies to whoever did - Can't give 'em credit


Function OnlyNumbers(text) As String

'Removes ANYTHING that does not fall into 0-9

    Dim s As String, t As String, x As Long

    If Len(Nz(text, "")) > 0 Then
        For x = 1 To Len(text)
            t = Mid(text, x, 1)
            Select Case t
                Case 0 To 9
                    s = s & t
            End Select
        Next x
    End If
    OnlyNumbers = s
 'Msgbox s
End Function



-----Original Message-----
From: Darren DICK [mailto:d.dick at uws.edu.au] 
Sent: Monday, 6 December 2004 1:38 PM
To: AccessD
Subject: A2003: Checking for dupe phone numbers

Hi Guys
I'm trying to comparing phone numbers and report dupes. 
 
Basically I get a user to enter a phone number - then check if it is already
in the dB If it is then I go to the record that already has it.
 
But of course people legitimately put in spaces after area codas and after
the prefixes.
So it becomes tricky to compare
 
eg 01 1234 5678 is the same number as 0112345678 but a simple dlookup won't
catch it
 
So I wanna remove all the spaces so I am comparing at least the same
'number'
 
OR
 
Do any of you have a method for comparing or routing out dupe phone
numbers??
 
Many thanks in advance
 
Darren




More information about the AccessD mailing list