Hello. I'm making a module to load info from a spreadsheet into the right tables. I have a query that looks like this:
Code:
Set orig_clients = CurrentDb.OpenRecordset( _
"(SELECT name, ssn, number, status FROM table WHERE (name IS NULL OR ssn IS NULL) AND number IS NOT NULL)" _
& " UNION " _
& "(SELECT DISTINCT name, ssn, number, status FROM table WHERE number IS NOT NULL AND name IS NOT NULL AND ssn IS NOT NULL)" _
& "ORDER BY number")
It takes all the distinct entries where the name and ssn is defined and all the entries where name or ssn is null and loads them together in one set. My problem is I want the number column but if two names have two different numbers, the names will repeat. How can I find all the distinct names but also load the numbers?
Any help would be greatly appreciated