How to compare recordsets in access vba
Collapse
X
-
Code:Debug.Print StrComp("Philadelphia","Philadelphia",vbBinaryCompare)
Code:Debug.Print StrComp("Philadelphia","philadelphia",vbBinaryCompare)
Code:Debug.Print StrComp("philadelphia","Philadelphia",vbBinaryCompare)
Comment
-
Just be aware that while this may be default behaviour it is probably not wise to rely on this setting being used universally in your code.Comment
-
This thread needs to focus on comparing 18K records against a like number, where each record in the first set is compared to every record in the second set. Someone calculated this is "324,000,00 0 iterations would be approximately 8.6 hours". This is 18000^2.=324,00 0,000.
If each table were sorted on the 4 fields, then each might be read sequentially with the lower one read and compared to the other.
Another approach would be to combine the 4 fields into a single field with some algorithm, and then find which had this combined field that was not in the other table, a simple SQL problem, I believe.
Leave the 4th field as text for the moment. Whatever algorithm is developed can take care of this. As long as it is only equal vs. not-equal, then only case sensitivity has to be considered. The field must be standardized (Trim(), remove double blanks, etc).Comment
-
Code:Debug.Print StrComp("Philadelphia","Philadelphia",vbBinaryCompare)
Code:Debug.Print StrComp("Philadelphia","philadelphia",vbBinaryCompare)
Code:Debug.Print StrComp("philadelphia","Philadelphia",vbBinaryCompare)
Thanks again, ill let you get back to solving the OPComment
-
What I like about this approach is that it makes no assumptions whatsoever about the Option Compare Setting on any given Access Database, in fact, it doesn't matter what it is.Comment
-
However, when asked a question pertaining directly to the Option Compare setting I have no problem answering it. I still wouldn't recommend relying on it generally.
I agree unreservedly. This is the method I'd use if I needed to.Comment
-
Starting from the right SQL will mean that the clever VBA coding is not required.Comment
Comment