OK here goes, I'll try to keep it brief.
I have a query that, via ODBC, links to an accounting package, specifically a table that stores actual spend and budgets. This query has a criteria specifying an overhead code bewteen x and y (for example). Also a criteria of cost centres between 1 and 9. The last criteria specifies the year. This query works and gives me all instances of actual spend and / or budget of overhead against cost centre. This therefore means that I may 2 lines for some cost centre / overhead combinations. One line for the actual spend that year and another line for the budget for the year. Based on that query I have two more, one that extracts just the actual spend for the year, the other that extracts just the budget info the year. Some cost centre / overhead combinations will therefore be in both of these queries, some will only be in one or the other. My last query combines the actual query and the budget query so that I can have one line per cost centre / overhead combination showing actual for period, budget for period, variance for period (simple formula), actual to date, budget to date, variance to date (simple formula), full budget for year. It is when the last query is run that the duplications occur. For Period 11 I know there are 1200 records in the actual query and 650 in the budget query. Therefore, the maximum there can be for P11 is 1850 records but when run the query returns 18000 ish repeating the cc /ohd many times. There is one other query which is a complete list of the ohd codes that is used with both the actual and budget queries to ensure that all ohds are extracted. Long winded I know, sorry.