Q: Appending crosstab query having dynamic variables
From: MarkD (anonymous_at_discussions.microsoft.com)
Date: 04/29/04
- Next message: Alan Nicoll: "Field properties in a Query"
- Previous message: MGFoster: "Re: DECODE equivalent"
- Next in thread: Duane Hookom: "Re: Appending crosstab query having dynamic variables"
- Reply: Duane Hookom: "Re: Appending crosstab query having dynamic variables"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 29 Apr 2004 13:40:08 -0700
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
- Next message: Alan Nicoll: "Field properties in a Query"
- Previous message: MGFoster: "Re: DECODE equivalent"
- Next in thread: Duane Hookom: "Re: Appending crosstab query having dynamic variables"
- Reply: Duane Hookom: "Re: Appending crosstab query having dynamic variables"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|
|