Hi
can anyone tell me why this query won't work and will ask for the [EssentialOilsShow] for the ORDER BY clue ?
It will work perfectly If I remove this field from the ORDER BY
It will sort perfectly for any other field [ProductName], [ProductPrice]...
Thanks
can anyone tell me why this query won't work and will ask for the [EssentialOilsShow] for the ORDER BY clue ?
It will work perfectly If I remove this field from the ORDER BY
It will sort perfectly for any other field [ProductName], [ProductPrice]...
Thanks
Code:
SELECT [Products].*, fnEssentialOilsShow([EssentialOilsCalc],[EssentialOilsQty],[BaseMaterialsQty],[EssentialOilsPercent]) AS [EssentialOilsShow] FROM [Products] WHERE [Products].[ProductID] Is Not Null ORDER BY [EssentialOilsShow] DESC, [Products].[ProductID] DESC
Public Function fnEssentialOilsShow(byEssentialOilsCalc As Byte, intEssentialOilsQty, intBaseMaterialsQty, bytEssentialOilsPercent) As String
Select Case byEssentialOilsCalc
Case 1
fnEssentialOilsShow = intEssentialOilsQty & " Drops / " & intBaseMaterialsQty & "ml"
Case 2, 3, 4
fnEssentialOilsShow = Format(bytEssentialOilsPercent, "0.0") & "%"
Case 5
fnEssentialOilsShow = ""
Case Else
fnEssentialOilsShow = ""
End Select
End Function
Last edited: