I have an application that was originally developed with an Access front and back end. I am converting it to an access front end with sql server back end.
There is one query which takes a long time even as a passthrough query. The query is:
SELECT Feeding.EventTurtleID ,
CASE WHEN Leftover.FeedingFishLeftover IS NULL THEN 0
END AS FeedingFishLeftover ,
CASE WHEN Feeding.FeedingFish = 0 THEN NULL
ELSE Feeding.FeedingFish - Leftover.FeedingFishLeftover
END AS [Fish%] ,
CASE WHEN Leftover.FeedingLettuceLeftover IS NULL THEN 0
END AS FeedingLettuceLeftover ,
CASE WHEN Feeding.FeedingLettuce = 0 THEN NULL
ELSE ( Feeding.FeedingLettuce - Leftover.FeedingLettuceLeftover )
END AS [Lettuce%]
FROM dbo.FeedingLeftover AS Leftover
INNER JOIN dbo.FeedingLeftover AS Feeding ON Leftover.EventTurtleID = Feeding.EventTurtleID
- 1 = Feeding.FeedingDate;
However if I add " WHERE EventTurtleID = 3110" the query is executed rapidly.
In a form, I have a control which allows me to get the EventTurtleID parameter. Is there a way to populate a subform with the results of the parameterized query where the results are obtained from a pass through query?