The following code produces the recordset exactly
the way I need it, when run using the Query Analyser. However,
when converted to an Access stored procedure it fails to do
the SELECT statement following the INSERT statement. I believe
its probably some basic concept illuding me.
Alan
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO
drop table #tpAggr
CREATE TABLE #tpAggr(
tname nvarchar(30) null,
tgross float null,
tMo int null,
tAe nvarchar(3) null,
)
INSERT INTO #tpAggr
SELECT Reps1.[Last Name], GrossCommsn, Month([settlement]), CASE WHEN
seelaus.ae='000' Then commsnae ELSE ae END
FROM Reps1 JOIN Seelaus ON Reps1.Rep = Seelaus.AE OR reps1.rep =
seelaus.commsnae
WHERE year(settlement)='2001' AND reps1.EmpStatus=1
SELECT tname, sum(tgross), tMo, tAe
FROM #tpAggr
GROUP BY tname, tAe, tMo
ORDER BY tname, tMo
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO