I have a query that we use in Access 97 and upgraded to Access 2003 and works fine. Now we want to run them using a SQL database but an Access 2003 frontend. When I open the new query in Access 2003 it takes close to an hour to run but when I run the same query in the Access 2003 database, it finishes in a short amount of time.
Here is the query:
In Access it used DISTINCTROW but in researching the problem I discovered that SQL uses DISTINCT so I tried that and it still doesn't work.
If I remove the GROUP BY it works in a short time but we need the GROUP BY if possible.
Does anyone know how to convert this so that it works?
Thanks.
Here is the query:
Code:
SELECT DISTINCT dbo_FundBalances.BBA_FUND AS Fund, dbo_FundBalances.FirstOfFUN_NAME AS Description, Sum((IIf([LED_ACCT_TYPE]="31" And ChangeToFiscalYear([LED_RECORD_DATE])=ChangeToFiscalYear(Forms!Reports!txtDate) And [LED_RECORD_DATE]<=Forms!Reports!txtDate,[LED_DOLLAR_AMT],0))) AS Income, Sum((IIf([LED_ACCT_TYPE]="22" And ChangeToFiscalYear([LED_RECORD_DATE])=ChangeToFiscalYear(Forms!Reports!txtDate) And [LED_RECORD_DATE]<=Forms!Reports!txtDate,[LED_DOLLAR_AMT],0))) AS Expenditures
FROM dbo_FundBalances, dbo_VLED
GROUP BY dbo_FundBalances.BBA_FUND, dbo_FundBalances.FirstOfFUN_NAME;
In Access it used DISTINCTROW but in researching the problem I discovered that SQL uses DISTINCT so I tried that and it still doesn't work.
If I remove the GROUP BY it works in a short time but we need the GROUP BY if possible.
Does anyone know how to convert this so that it works?
Thanks.