Hi All,
Really thought this was going to be straightforward but:
I have a function that I want to return the number of a consumable to use. The function is run through a query
There's 30 consumables C1 to C30
If the DLookup is true I want to return the corresponding consumable
e.g.
For a "Pink Needle" which is C1 I need the output to be 6, the below function returns C1 rather than the argument C1 = 6
Any advise greatly appreciated
Really thought this was going to be straightforward but:
I have a function that I want to return the number of a consumable to use. The function is run through a query
There's 30 consumables C1 to C30
If the DLookup is true I want to return the corresponding consumable
e.g.
Code:
e.g. ?ConsumableToUse("Pink Needle",1,6,3,1,1,,,,,,,,,,,,,,,,,,,,,,,,,,,1)
Code:
Public Function ConsumableToUse(DrugNameVialCurrent As String, ConsumableNumberCurrent As Integer, Optional ByVal C1 As Double, Optional C2 As Double, Optional C3 As Double, Optional C4 As Double, Optional C5 As Double, Optional C6 As Double, Optional C7 As Double, Optional C8 As Double, Optional C9 As Double, Optional C10 As Double, Optional C11 As Double, Optional C12 As Double, Optional C13 As Double, Optional C14 As Double, Optional C15 As Double, Optional C16 As Double, Optional C17 As Double, Optional C18 As Double, Optional C19 As Double, Optional C20 As Double, Optional C21 As Double, Optional C22 As Double, Optional C23 As Double, Optional C24 As Double, Optional C25 As Double, Optional C26 As Double, Optional C27 As Double, Optional C28 As Double, Optional C29 As Double, Optional C30 As Double, Optional ExtraVariable As Integer) As Double
If DLookup("DrugNameVial", "tblDrugWeightCost", "[ConsumableNumber]=" & ConsumableNumberCurrent) = DrugNameVialCurrent Then
VariableToTake = ("C" & Trim(Str(ConsumableNumberCurrent)))
ConsumableToUse = VariableToTake
End If
End Function
Any advise greatly appreciated