Crosstab Query Help

N

Newbie

Hi,

I have the following query

PARAMETERS [forms]!frmMetalRequirements![dtpDateTo] DateTime;
TRANSFORM Sum(tblMatlSchedule.OSQtyReqd) AS SumOfOSQtyReqd
SELECT tblMatlSchedule.JobNo, tblMatlSchedule.Stockcode,
tblMatlSchedule.StartDate,
IIf(Left$(tblMatlSchedule.Stockcode,1)="A","A","B") AS MetalType
FROM tblMatlSchedule
GROUP BY tblMatlSchedule.JobNo, tblMatlSchedule.Stockcode,
tblMatlSchedule.StartDate, MetalType
PIVOT "Wk" &
IIf(DateDiff("ww",[StartDate],Forms!frmMetalRequirements!dtpDateTo)>11,"11",
DateDiff("ww",[StartDate],Forms!frmMetalRequirements!dtpDateTo)) In
("Wk0","Wk1","Wk2","Wk3","Wk4","Wk5","Wk6","Wk7","Wk8","Wk9","Wk10","Wk11");

However, when it runs it asks for a parameter MetalType
How can I stop it asking for this?

Thanks
 
M

Michel Walsh

Hi


In the GROUP BY clause, change MetalType by:
IIf(Left$(tblMatlSchedule.Stockcode,1)="A","A","B")


Hoping it may help,
Vanderghast, Access MVP
 

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