Q: Appending crosstab query having dynamic variables

M

MarkD

Using Access 2000.

Hi,

I have a crosstab query that has a dynamic variable:

PARAMETERS [age] Short;
TRANSFORM Sum(IIf(DateDiff("m",[datefirstprrun],
[maxoftrans_dt])>=[age],1,0)) AS Expr1
SELECT [Q Raw].Region, [Q Raw].Name1, [age] AS MonthsOld
FROM [Q Raw]
GROUP BY [Q Raw].Region, [Q Raw].Name1, [age]
PIVOT DateDiff("m",#1/1/2003#,[datefirstprrun]);

[Q Raw] is just a query, and [age] is a variable ranging
from 1-24.

I want to run the above query 24 times, appending the
results into one giant historical table, changing the
[age] parameter from 1-24. I'd like to run this in code
and just have a loop run through 1-24. What I don't know
how to do is pass the variable to the query. I thought I
could just pass the whole query (something like "insert
into [big table] select [xtab query]") but don't really
know the syntax.

Hopefully that was clear. Any ideas?

In advnace, thanks.
-Mark
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top