Dear Experts,
I am using the following function to get the Budgeted Seed Rate on a given market date:
Public Function GetSdBudgetRate(MktCenter As Integer, MktVty As Integer, MktDt As Date, factoryType As String) As Double
If [factoryType] = "TMC" Then
GetSdBudgetRate = Nz(DLookup("budgetedSeedRate", "BudgetAndMktQry", "dateOfMarket=#" & MktDt & "# And[marketInCenter]=" & [MktCenter] & "And[varietyArrived]=" & [MktVty]), 0)
Else
GetSdBudgetRate = Nz(DLookup("budgetedSeedRate-Con", "BudgetAndMktQry", "dateOfMarket=#" & MktDt & "# And[marketInCenter]=" & [MktCenter] & "And[varietyArrived]=" & [MktVty]), 0)
End If
End Function
For some dates it returns the Rate, but for some dates, even though data is available, it returns 0. My system's OS is Windows 7 Professional and I am using MS Access 2007. When I tried this in a system having Windows XP, it worked fine.
Is there anything wrong in the code?
Regards,
Alex