There is no way to know if joesmith@abc.com and joe.smith@abc.com are the same person.
Actually, I would design my code to assume they are NOT the same.
Based on that logic, there is no code that you could write. You would have to have some data integrity rules on the table. Or the OP will have to provide more exclusion rules.
Because if in table 2, the name can be written with a period or without a period
like:
peterambo
Without additional information, there is no way to know for certain if it matches any of these
peter.ambo@abc.com
pete.rambo@abc.com
peterambo@abc.com
You would have to verify manually.
The only ones you could match with certainty would be those of the form (first.last) in both tables.
1)So build a query to match (first.last formatted names). Use a where clause to eliminate those without a period. Then use this function
Code:
Public Function CleanEmail(email As Variant) As String
If Not IsNull(email) Then
CleanEmail = Split(email, "@")(0)
End If
End Function
This returns all records with "first.last" in both tables
2)Create another query using the same function but with a where clause that only includes records without a period
This returns all matches of the form "firstlast" in both tables
As pointed out this is still uncertain.
3)Create a union query of 1 and 2. These should be pretty good matches
4) Use the original function provided and a where clause to include only records where the left table is of the form (first.last) and the right table is of the form (firstlast).
Verify all records manually, and apply additional logic to determine if a match.
5)Do the same as 4 but left is of the form (firstlast) and right of the form (first.last)
verify all records manually.