G
Guest
I created a query to run against a table with 106 records. The query uses
dlookup to calculate a value based on the record before it.
The query takes a ridiculously long time to run. I have compressed and
repaired. Is there anything else I can do to speed up the query? The sql is
below
Thanks
DMG
SELECT tblNewCusip.ID, tblNewCusip.Cusip, tblNewCusip.Memo, tblNewCusip.CPS,
IIf([NewCusip]=0,0,DLookUp("[Lot]","[qryTake]","[ID]=" &
[ID]-1)+DLookUp("[Total]","[qryTake]","[ID]=" & [ID]-1)) AS Total,
IIf([Total]<[tblInkindTrades_Shares],IIf([qryLowCost_Shares]>([tblInkindTrades_Shares]-[Total]),([tblInkindTrades_Shares]-[Total]),[qryLowCost_Shares]),0)
AS Lot
FROM tblNewCusip;
dlookup to calculate a value based on the record before it.
The query takes a ridiculously long time to run. I have compressed and
repaired. Is there anything else I can do to speed up the query? The sql is
below
Thanks
DMG
SELECT tblNewCusip.ID, tblNewCusip.Cusip, tblNewCusip.Memo, tblNewCusip.CPS,
IIf([NewCusip]=0,0,DLookUp("[Lot]","[qryTake]","[ID]=" &
[ID]-1)+DLookUp("[Total]","[qryTake]","[ID]=" & [ID]-1)) AS Total,
IIf([Total]<[tblInkindTrades_Shares],IIf([qryLowCost_Shares]>([tblInkindTrades_Shares]-[Total]),([tblInkindTrades_Shares]-[Total]),[qryLowCost_Shares]),0)
AS Lot
FROM tblNewCusip;