I can get this example from Allen Browne to apply to my database ok, however I'm stuck on getting 3 sets of values. In the example below I get qty and amt. In my example I'm trying to get qty, amt and budget.
I added budget to the tblxtabcolumns and I can get it to pull up as a column however the value is the same value as the amount column as without further work on the SQL it's assuming the fieldname is not equal to "QTY" it must be AMT. I assume that the TRANSFORM statement needs a nested IIF but I keep getting syntax errors. Any push in the proper direction?
From Allen Browne Xtab tutorial
http://allenbrowne.com/ser-67.html#MultipleValues
TRANSFORM Sum(IIf([FieldName]="Qty",[Quantity],[Quantity]*[Order Details]![UnitPrice])) AS TheValue
SELECT Products.ProductName
FROM tblXtabColumns, Products INNER JOIN (Orders INNER JOIN [Order Details]
ON Orders.OrderID = [Order Details].OrderID) ON Products.ProductID = [Order Details].ProductID
WHERE (Orders.OrderDate Between #1/1/1998# And #3/31/1998#)
GROUP BY Products.ProductName
PIVOT [FieldName] & Month([OrderDate]);
I added budget to the tblxtabcolumns and I can get it to pull up as a column however the value is the same value as the amount column as without further work on the SQL it's assuming the fieldname is not equal to "QTY" it must be AMT. I assume that the TRANSFORM statement needs a nested IIF but I keep getting syntax errors. Any push in the proper direction?
From Allen Browne Xtab tutorial
http://allenbrowne.com/ser-67.html#MultipleValues
TRANSFORM Sum(IIf([FieldName]="Qty",[Quantity],[Quantity]*[Order Details]![UnitPrice])) AS TheValue
SELECT Products.ProductName
FROM tblXtabColumns, Products INNER JOIN (Orders INNER JOIN [Order Details]
ON Orders.OrderID = [Order Details].OrderID) ON Products.ProductID = [Order Details].ProductID
WHERE (Orders.OrderDate Between #1/1/1998# And #3/31/1998#)
GROUP BY Products.ProductName
PIVOT [FieldName] & Month([OrderDate]);