I have a strange problem which I have not been able to solve after hours and hours of google searching. I have a report in Access 2003 which is based on a pass-through query linked to an SQL Server 2005 database. On a button click I alter the SQL of a saved pass-through query which the report has as it's recordsource.
In Management Studio the query runs in about 15 seconds. If I run the query directly from the Queries pane in Access, it also takes about 15 seconds. However, when I open the report based on the pass-through query, it takes around 3-4 minutes. I have tried using a make-table query to have the pass-through query results append to a temp table and then based the report on that, the CurrentDb.Execute line in VBA takes 3-4 minutes to run. Same as if I have the temp table already created and use an append query.
Any ideas would be much appreciated!
In Management Studio the query runs in about 15 seconds. If I run the query directly from the Queries pane in Access, it also takes about 15 seconds. However, when I open the report based on the pass-through query, it takes around 3-4 minutes. I have tried using a make-table query to have the pass-through query results append to a temp table and then based the report on that, the CurrentDb.Execute line in VBA takes 3-4 minutes to run. Same as if I have the temp table already created and use an append query.
Any ideas would be much appreciated!