D
DS
I have this SQL statement that works as a Query, but when I make it an
SQL statement my listbox keeps drawing a blank. Could it be a Syntax
Error? Any help appreciated.
Thanks
DS
With Forms!CheckPreview!ListOrders
..RowSource = "SELECT SalesDetails.SalesID, SalesDetails.LineID, " & _
"IIf(SalesDetailsMoney.QtyPrice=1,"",SalesDetailsMoney.QtyPrice) AS QTY,
" & _
"SalesDetailsMoney.ItemID, IIf([Sub]=1,Items.ItemName,IIf([Sub]=2,""
"" & Items.ItemName,IIf([Sub]=3,"" "" & Items.ItemName))) AS
EName, " & _
"Format([SalesDetailsMoney].[BasePrice]*[SalesDetailsMoney].[QtyPrice],""$0.00"")
AS Price, " & _
"Items.ItemType, Items.Tax " & _
"FROM (SalesDetails LEFT JOIN SalesDetailsMoney ON (SalesDetails.LineID
= SalesDetailsMoney.LineID) " & _
"AND (SalesDetails.SalesID = SalesDetailsMoney.SalesID)) " & _
"INNER JOIN Items ON SalesDetails.ItemID = Items.ItemID " & _
"GROUP BY SalesDetails.SalesID, SalesDetails.LineID, " & _
"IIf(SalesDetailsMoney.QtyPrice=1,"",SalesDetailsMoney.QtyPrice), " & _
"SalesDetailsMoney.ItemID, IIf([Sub]=1,Items.ItemName,IIf([Sub]=2,""
"" & Items.ItemName,IIf([Sub]=3,"" "" & Items.ItemName))), " & _
"Format([SalesDetailsMoney].[BasePrice]*SalesDetailsMoney.QtyPrice,""$0.00""),
" & _
"Items.ItemType, Items.Tax " & _
"HAVING (((SalesDetails.SalesID) = [Forms]![CheckAction]![TxtSalesID]))
" & _
"ORDER BY SalesDetails.LineID, Items.ItemType;"
..Requery
..ColumnCount = 8
..ColumnWidths = "0 in;0 in;0.2 in;0 in;2.5 in;0.5 in;0 in;0 in"
End With
SQL statement my listbox keeps drawing a blank. Could it be a Syntax
Error? Any help appreciated.
Thanks
DS
With Forms!CheckPreview!ListOrders
..RowSource = "SELECT SalesDetails.SalesID, SalesDetails.LineID, " & _
"IIf(SalesDetailsMoney.QtyPrice=1,"",SalesDetailsMoney.QtyPrice) AS QTY,
" & _
"SalesDetailsMoney.ItemID, IIf([Sub]=1,Items.ItemName,IIf([Sub]=2,""
"" & Items.ItemName,IIf([Sub]=3,"" "" & Items.ItemName))) AS
EName, " & _
"Format([SalesDetailsMoney].[BasePrice]*[SalesDetailsMoney].[QtyPrice],""$0.00"")
AS Price, " & _
"Items.ItemType, Items.Tax " & _
"FROM (SalesDetails LEFT JOIN SalesDetailsMoney ON (SalesDetails.LineID
= SalesDetailsMoney.LineID) " & _
"AND (SalesDetails.SalesID = SalesDetailsMoney.SalesID)) " & _
"INNER JOIN Items ON SalesDetails.ItemID = Items.ItemID " & _
"GROUP BY SalesDetails.SalesID, SalesDetails.LineID, " & _
"IIf(SalesDetailsMoney.QtyPrice=1,"",SalesDetailsMoney.QtyPrice), " & _
"SalesDetailsMoney.ItemID, IIf([Sub]=1,Items.ItemName,IIf([Sub]=2,""
"" & Items.ItemName,IIf([Sub]=3,"" "" & Items.ItemName))), " & _
"Format([SalesDetailsMoney].[BasePrice]*SalesDetailsMoney.QtyPrice,""$0.00""),
" & _
"Items.ItemType, Items.Tax " & _
"HAVING (((SalesDetails.SalesID) = [Forms]![CheckAction]![TxtSalesID]))
" & _
"ORDER BY SalesDetails.LineID, Items.ItemType;"
..Requery
..ColumnCount = 8
..ColumnWidths = "0 in;0 in;0.2 in;0 in;2.5 in;0.5 in;0 in;0 in"
End With