P
Paulo
Can someone spot the syntax error in this SQL string? I tried, but could not
see where it is.
Thanks in advance,
Paulo
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Set qdfTemp = CurrentDb.CreateQueryDef("Current Orders Set", _
"SELECT IIf([Orders]![Status]='REC',[Orders]![DC Cims Week
Actual],[Orders]![ETA to DC Cims Week]) " & _
"AS RelevantWeek, Sum(Orders.[Order Qty]) AS [SumOfOrder Qty],
Sum(Orders.[Received Qty]) AS [SumOfReceived Qty], " & _
"Sum(IIf([Orders]![Channel]='WHOLESALE',IIf([Orders]![Status]='REC',[Orders]![Received Qty]*[WSale Price], " & _
"[Orders]![Order Qty]*[WSale
Price]),IIf([Orders]![Status]='REC',[Orders]![Received Qty]*[Std Retail
Price], " & _
"[Orders]![Order Qty]*[Std Retail Price]) AS Revenue,
Sum(IIf([Orders]![Status]='REC', " & _
"[Orders]![Received Qty]*[Landed GBP Cost],[Orders]![Order
Qty]*[Landed GBP Cost])) AS Costs, " & _
"Orders.[Col Ssn], Orders.Currency, Orders.Channel, Orders.Supplier
FROM Orders WHERE" & _
strWhere)
see where it is.
Thanks in advance,
Paulo
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Set qdfTemp = CurrentDb.CreateQueryDef("Current Orders Set", _
"SELECT IIf([Orders]![Status]='REC',[Orders]![DC Cims Week
Actual],[Orders]![ETA to DC Cims Week]) " & _
"AS RelevantWeek, Sum(Orders.[Order Qty]) AS [SumOfOrder Qty],
Sum(Orders.[Received Qty]) AS [SumOfReceived Qty], " & _
"Sum(IIf([Orders]![Channel]='WHOLESALE',IIf([Orders]![Status]='REC',[Orders]![Received Qty]*[WSale Price], " & _
"[Orders]![Order Qty]*[WSale
Price]),IIf([Orders]![Status]='REC',[Orders]![Received Qty]*[Std Retail
Price], " & _
"[Orders]![Order Qty]*[Std Retail Price]) AS Revenue,
Sum(IIf([Orders]![Status]='REC', " & _
"[Orders]![Received Qty]*[Landed GBP Cost],[Orders]![Order
Qty]*[Landed GBP Cost])) AS Costs, " & _
"Orders.[Col Ssn], Orders.Currency, Orders.Channel, Orders.Supplier
FROM Orders WHERE" & _
strWhere)