I am trying to compare two columns in Access with a query and show when they don't match
If I understand correctly I would do this a little different.
Obviously, this isn't real data because trying to show names that don't match using only last names will not give you good results - Smith, John and Smith, Jim would match but they are different people.
Anyway, first create a query named "qrySheet1".
SQL would be
Code:
SELECT lastname FROM Sheet1;
Second, create a query named "qrySheet2".
SQL would be
Code:
SELECT IIf(InStr([fullname],",")>0,Left([fullname],InStr([fullname],",")-1),[fullname]) AS lastname FROM Sheet2;
Last, use the Query wizard to create an unmatched query. The SQL would look like:
Code:
SELECT qrySheet2.lastname
FROM qrySheet2 LEFT JOIN qrySheet1 ON qrySheet2.[lastname] = qrySheet1.[lastname]
WHERE (((qrySheet1.lastname) Is Null));