473,800 Members | 2,368 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help needed with First/Last Name combinations

Does anyone know of or have any VBA code or similar logic that can
help distinguish similar first/last name combinations? For example, we
would like to prompt the user of a possible match when any of the
first/last names Robert Smith, or Bob Smith, or Robt. Smith are used
during data entry. All that is necessary is to alert the user so that
they can review any appropriate existing records.

We have done several google searches without any luck. Any and all
help is appreciated.

TC

May 30 '06 #1
2 2527
On Tue, 30 May 2006 08:28:31 -0400, Tony Ciconte
<to******@comca st.net> wrote:

I have successfully integrated the Ratcliff/Obershelp algorithm, which
calculates the similarity between two strings. Anything over a certain
threshold would be run by the user: "Is it one of these?". AFAIK it is
only available in C.

-Tom.
Does anyone know of or have any VBA code or similar logic that can
help distinguish similar first/last name combinations? For example, we
would like to prompt the user of a possible match when any of the
first/last names Robert Smith, or Bob Smith, or Robt. Smith are used
during data entry. All that is necessary is to alert the user so that
they can review any appropriate existing records.

We have done several google searches without any luck. Any and all
help is appreciated.

TC


May 30 '06 #2
Tony Ciconte <to******@comca st.net> wrote:
: Does anyone know of or have any VBA code or similar logic that can
: help distinguish similar first/last name combinations? For example, we
: would like to prompt the user of a possible match when any of the
: first/last names Robert Smith, or Bob Smith, or Robt. Smith are used
: during data entry. All that is necessary is to alert the user so that
: they can review any appropriate existing records.

I wrote *very crude* code for this: it matches the alphanumeric
content of strings, *without any regard for order*, so although it
often works very well, you'll find some real howlers.
It sets a threshhold for matching that you can of course change.
Here's my code; excuse the numbers at the beginning of each line:
I got it from an Access export file before I learned how to export the
code alone.

--thelma

-----------------------------------------------------------------------

'------------------------------------------------------------------'
' RATEMATCH '
'------------------------------------------------------------------'
Function ratematch(ByVal listmember As String, _
ByVal guess As String) As Integer

372 '------------------------------------------------------------'
373 ' This Function computes a very crude 'match'-score for a '
374 ' tablemember as compared with a user entry that matched '
' no table member. It counts the alphanumeric characters '
' shared by the two, ignoring order and non alphanumeric '
' characters, but not collapsing duplicates. '
' Function Return: '
' 0=>match unlikely; 1=>exact match 2=>could be match '
378 '------------------------------------------------------------'
379
382
383 Dim guessLen As Integer
398 Dim gpos As Integer
399 Dim i As Integer
400 Dim lenNow As Integer
384 Dim ListMemberLen As Integer
401 Dim match As Integer

402 Dim nexletter As String

420 Dim mFrac As Single

380 listmember = _
OnlyAlphaNumeri cChars(listmemb er) ' Remove nonalphanumeric s

381 guess = _
OnlyAlphaNumeri cChars(guess) ' from strings to compare

386 ratematch = 0 ' Not a Match

388 ListMemberLen = Len(listmember) ' Length of String from List
389 If ListMemberLen = 0 Then _
Exit Function ' Null is not Valid Guess

391 guessLen = Len(guess) ' Length of User Input

393 If InStr(listmembe r, guess) = 1 And ListMemberLen = guessLen Then
394 ratematch = 1 ' Exact alphanumeric Match
395 Exit Function
396 End If
397
404 match = 0

405
406 For i = 1 To guessLen
407 lenNow = Len(listmember)
408 If lenNow = 0 Then Exit For ' No string left to search
409 nexletter = Mid(guess, i, 1)
410 gpos = InStr(listmembe r, nexletter) ' Seek char in table entry

411 If gpos > 0 Then ' Char Found
412 match = match + 1 ' Increment matchcount
413 listmember = _
414 Left(listmember , gpos - 1) & _
415 Right(listmembe r, lenNow - gpos) ' Remove char matched
416 End If

417 Next
418
419 ' Accept if Fraction of name matched >= mFrac
421 If ListMemberLen > 4 And guessLen > 4 Then
422 mFrac = 0.8
423 Else
424 mFrac = 0.75
425 End If
426
427 If ListMemberLen > 0 And guessLen > 0 Then
428 If match / ListMemberLen >= mFrac And _
match / guessLen >= mFrac Then
429 ratematch = 2 ' Acceptable Alphanum Match
430 End If
431 End If
432
433 End Function
435 Public Function OnlyAlphaNumeri cChars(ByVal OrigString As _
436 String) As String
437

438 '------------------------------------------'
439 ' I found this function on the internet: '
440 ' DevX.com '

441 ' http://www.freevbcode.com/ '
442 ' Author: Intelligent Solutions Inc. '
443 '------------------------------------------'

444
445 '************** *************** *************** ***************
446 'INPUT: Any String

447 'OUTPUT: The Input String with all non-alphanumeric characters
448 ' removed
449 '************** *************** *************** ***************

450 Dim lLen As Long
451 Dim sAns As String
452 Dim lCtr As Long

453 Dim sChar As String
454 Dim zap As Boolean
455

456
457 OrigString = Trim(OrigString )
458 lLen = Len(OrigString)

459
460 zap = OrigString Like "*[!0-9A-Za-z]*"
461 If zap = False Then

462 OnlyAlphaNumeri cChars = OrigString
463 Exit Function
464 End If

465
466 For lCtr = 1 To lLen
467 sChar = Mid(OrigString, lCtr, 1)

468 ' If IsAlphaNumeric( Mid(OrigString, lCtr, 1)) Then
469 If sChar Like "[0-9A-Za-z]" Then
470 sAns = sAns & sChar

471 End If
472 ' DoEvents '(optional, but if processing long string,
473 'necessary to prevent program from appearing to hang)

474 'if used, write your app so no re-entrancy into this function
475 'can occur)
476 Next

477
478 OnlyAlphaNumeri cChars = sAns
479

480 End Function
481
482 Private Function IsAlphaNumeric( sChr As String) As Boolean

483 IsAlphaNumeric = sChr Like "[0-9A-Za-z]"
484 End Function
485
-----------------------------------------------------------------------
: We have done several google searches without any luck. Any and all
: help is appreciated.

: TC

May 30 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1324
by: Simon | last post by:
Hi, I have a table with a column that contains many names, like "Ant Simon Lucy", if I was looking for one name in the string of names I would do... SELECT * from classroom where name LIKE '%ant%'. But the select above will return rows with names like 'antoine' or 'anthony'.
1
8753
by: PT | last post by:
I got a problem. And thats..... First of all, I got these three tables. ------------------- ------------------ ---------------------- tblPerson tblPersonSoftware tblSoftware ------------------- ------------------ ---------------------- PID PName PID* SID* SID SWName --- ----- --- --- --- ------ 1 Thomas 1 1 ...
5
1539
by: Chris Kettenbach | last post by:
Good Morning, Sorry for xposting. Just need a liitle help. I have an xml file that's generated from a database. How do I select distinct values from a field in xslt and then loop through the records and produce output. Example <registrations> <registration> <company>Awesome Printers</company> <first>John</first>
4
1833
by: Chris Kettenbach | last post by:
Hi Peter, I get error when processing the stylesheet. It errors here. <xsl:for-each select="registration)=1]"> specifically: Expression does not return a DOM node. registration)=1]<--
6
2883
by: Jamal | last post by:
I am working on binary files of struct ACTIONS I have a recursive qsort/mergesort hybrid that 1) i'm not a 100% sure works correctly 2) would like to convert to iteration Any comments or suggestion for improvements or conversion to iteration would be much appreciated
4
2242
by: Norman Fritag | last post by:
Hi there, >>>__ 1020.83, 2305.22, 1176.86, 755.12, 123.41 __ 1976.1, 1325.99, 947, 718.03, 414.32 __ 1020.83, 1976.1, 352.5, 947, 718.03, 366.98 Their IDs were as ---------------------------------------------- __ 508671, 508789, 508850, 513108, 514552 __ 507960, 509289, 509149, 511454, 512759__ 508671, 507960, 510436, 509149, 511454, 513633 <<<
5
3440
by: thetrueaplus | last post by:
Hey all. I have bit shifted my enum values all the way to 31 items. I feel that this api that i am using continues to grow, i will be stuck with out any more items in my enum. I would like to promote the enum to a long if possible so that it will be 64 bits long. Thanks.
0
5577
by: gunimpi | last post by:
http://www.vbforums.com/showthread.php?p=2745431#post2745431 ******************************************************** VB6 OR VBA & Webbrowser DOM Tiny $50 Mini Project Programmer help wanted ******************************************************** For this teeny job, please refer to: http://feeds.reddit.com/feed/8fu/?o=25
2
2906
by: rookiejavadude | last post by:
I'm have most of my java script done but can not figure out how to add a few buttons. I need to add a delete and add buttong to my existing java program. Not sure were to add it on how. Can anyone help? my script is below. thank you import java.awt.*; //import all java.awt import java.awt.event.*; //import all java.awt.event import java.util.*; //import all java.util import javax.swing.*; //import all javax.swing class Product...
0
9551
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10505
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10276
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10035
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9090
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7580
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6813
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5471
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5606
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.