Without artificial intelligence there is no query in the world that would know that MW04967EX and MW4967 is the same invoice# or a differetn invoice#. So what you need is a strategy and that strategy should focus on the common type of mistakes.
So I would have lots of queries to identify possible problems. Since you probably know the likely problems, focus on those rules first.
You showed two possible rules.
1) like records with spaces.
So for that problem I would make a simple function
Public Function removeSpaces(strInvoice As String) As String
removeSpaces = Replace(strInvoice, " ", "")
End Function
Then use that in a query
SELECT
removeSpaces([tblA.invoice#]) AS NoSpaceA,
tblB.[invoice#]
FROM
tblA,
tblB
WHERE
removeSpaces([tblA.invoice#])=removeSpaces([tblB.invoice#])
2) Maybe if all the numeric part is the same I check that
Code:
Public Function MakeNumeric(strText As String) As Long
If strText = vbNullString Then MakeNumeric = 0
Dim Characters(10) As String, i As Integer, sTemp As String
If Len(strText) > UBound(Characters) Then
strText = Left(strText, UBound(Characters))
End If
For i = 1 To Len(strText)
Characters(i - 1) = Right(Left(strText, i), 1)
Next
For i = 0 To UBound(Characters)
If Not Characters(i) = vbNullString Then
If IsNumeric(Characters(i)) = True And Not Characters(i) = Chr(32) Then
sTemp = sTemp & Characters(i)
End If
End If
Next
MakeNumeric = sTemp
End Function
SELECT
makeNumeric([tblA.invoice#]) AS NumericA,
tblB.[invoice#]
FROM
tblA,
tblB
WHERE makeNumeric([tblA.invoice#]))=makeNumeric([tblB.invoice#])
3) now I could build a function "makeAlpha" and check if the non numeric part is the same
4) then I might want to check if the left N characters math the left N characters in B
Code:
Public Function leftX(strInvoice As String, X As Integer) As String
leftX = Left(strInvoice, X)
End Function
Public Function rightX(strInvoice As String, X As Integer) As String
rightX = Right(strInvoice, X)
End Function
SELECT
tblA.[invoice#],
tblB.[invoice#]
FROM
tblA,
tblB
WHERE
tblB.[invoice#]) Like leftx([tblA.invoice#],4) & "*")) OR (((tblA.[invoice#]) Like leftx([tblb.invoice#],3) & "*"
Get the general strategy? You can probably define better rules because you know the likely errors.