D
dgmueller
I thought someone could help me with this small problem. I have two
parameters in my make table and one of them is the table name for the
make table.
When I run the query, it filters based on the [DeptNo] fine, but when
correctly prompted to enter the @TableName, Ex "MyTable", it does
prompt me but then saves the new table under a table name as
@Tablename rather then "MyTable" I want to eventually put this in
VBA and loop through a recordset calling this query and saving results
under different names based on the information in the recordset I am
looping through. I figure, this can be done (using the tablename as a
parameter) or not, and if so, I am just using the wrong syntax or
something.
Any ideas?
PARAMETERS DeptNo Text ( 255 ), [@TableName] Text ( 255 );
SELECT AUMaster.Lawson, ChgMstr.DEPT, ChgMstr.[CHG CD], ChgMstr.
[REVENUE DESCRIPTION], [Prior and Curr Year Revenue - Qty].Price,
ChargeCodeProfile.[Count per Charge] AS Weight, [Prior and Curr Year
Revenue - Qty].[2006 Projected Quantity], [Prior and Curr Year Revenue
- Qty].[2006 Projected Revenue], [Prior and Curr Year Revenue - Qty].
[2007 Projected Quantity], [Prior and Curr Year Revenue - Qty].[2007
Projected Revenue] INTO [@TableName]
FROM ((ChgMstr LEFT JOIN [Prior and Curr Year Revenue - Qty] ON
ChgMstr.[CHG CD] = [Prior and Curr Year Revenue - Qty].ChargeCode)
LEFT JOIN ChargeCodeProfile ON ChgMstr.[CHG CD] = ChargeCodeProfile.
[CHG CD]) LEFT JOIN AUMaster ON ChgMstr.DEPT = AUMaster.Affinity
WHERE (((ChgMstr.DEPT)=[DeptNo]));
parameters in my make table and one of them is the table name for the
make table.
When I run the query, it filters based on the [DeptNo] fine, but when
correctly prompted to enter the @TableName, Ex "MyTable", it does
prompt me but then saves the new table under a table name as
@Tablename rather then "MyTable" I want to eventually put this in
VBA and loop through a recordset calling this query and saving results
under different names based on the information in the recordset I am
looping through. I figure, this can be done (using the tablename as a
parameter) or not, and if so, I am just using the wrong syntax or
something.
Any ideas?
PARAMETERS DeptNo Text ( 255 ), [@TableName] Text ( 255 );
SELECT AUMaster.Lawson, ChgMstr.DEPT, ChgMstr.[CHG CD], ChgMstr.
[REVENUE DESCRIPTION], [Prior and Curr Year Revenue - Qty].Price,
ChargeCodeProfile.[Count per Charge] AS Weight, [Prior and Curr Year
Revenue - Qty].[2006 Projected Quantity], [Prior and Curr Year Revenue
- Qty].[2006 Projected Revenue], [Prior and Curr Year Revenue - Qty].
[2007 Projected Quantity], [Prior and Curr Year Revenue - Qty].[2007
Projected Revenue] INTO [@TableName]
FROM ((ChgMstr LEFT JOIN [Prior and Curr Year Revenue - Qty] ON
ChgMstr.[CHG CD] = [Prior and Curr Year Revenue - Qty].ChargeCode)
LEFT JOIN ChargeCodeProfile ON ChgMstr.[CHG CD] = ChargeCodeProfile.
[CHG CD]) LEFT JOIN AUMaster ON ChgMstr.DEPT = AUMaster.Affinity
WHERE (((ChgMstr.DEPT)=[DeptNo]));