How can I get only distinct results for multiple unions that are built programatically?
Posted on 2009-05-13
VBA, Access 2003
I have six queries that may potentially be built programatically into one query where they are unioned together. The end result shows up to the user in a list box. I am having problems with duplicate items showing up. This is occuring because at times two or more of the queries are selecting the same rows. Usually I expect a union of two tables only to include distinct results but that does not seem to be the case when there are more than two.
Anyone have any ideas on how to solve this? I'm thinkig putting the results into a temporary table and then doing a SELECT with DISTINCT as the row source for my list box. That sounds like it could be slow though and this application updates the searches on every key press so I don't want to add anything more than I have to.