Hello everybody,
I am returning to the Forum after a long gap.
I created a Function as follows:
Public Function GetLintBudget(MktSeason As Integer, MktCenter As Integer, MktVty As Integer, MktDt As Date, factoryType As String) As Double
If [factoryType] = "TMC" Then
GetLintBudget = Nz(DLookup("budgetedLint", "tblMarketAndBudget", "dateOfMarket=#" & MktDt & "# And[marketSeason]=" & [MktSeason] & "And[marketInCenter]=" & [MktCenter] & "And[varietyArrived]=" & [MktVty]), 0)
Else
GetLintBudget = Nz(DLookup("budgetedLint-Con", "tblMarketAndBudget", "dateOfMarket=#" & MktDt & "# And[marketSeason]=" & [MktSeason] & "And[marketInCenter]=" & [MktCenter] & "And[varietyArrived]=" & [MktVty]), 0)
End If
End Function
In the query based upon the Function, for certain dates, the Budgeted Lint returns the value, but for the remaining dates 0 is returned, even though values are in the table for the corresponding dates.
I will be very happy if some experts can solve the problem.
Regards
Alex