This function looks up values in the specified table, (either L1 or L05) column, (SURVIVE or EXPECT) and row. How can I make this run faster?
Function lookupBLDcurve(fldCurve, number)
Select Case fldCurve
Case "SL1" lookupBLDcurve = Nz(DLookup("SURVIVE", "L1", "fldAgeOfAvgLife = " & number))
Case "EL1"
lookupBLDcurve = Nz(DLookup("EXPECT", "L1", "fldAgeOfAvgLife = " & number))
Case "SL05"
lookupBLDcurve = Nz(DLookup("SURVIVE", "L05", "fldAgeOfAvgLife = " & number))
Case "EL05"
lookupBLDcurve = Nz(DLookup("EXPECT", "L05", "fldAgeOfAvgLife = " & number))
Case Else
lookupBLDcurve = -1
End Select
End Function
Thanks for your help.
Function lookupBLDcurve(fldCurve, number)
Select Case fldCurve
Case "SL1" lookupBLDcurve = Nz(DLookup("SURVIVE", "L1", "fldAgeOfAvgLife = " & number))
Case "EL1"
lookupBLDcurve = Nz(DLookup("EXPECT", "L1", "fldAgeOfAvgLife = " & number))
Case "SL05"
lookupBLDcurve = Nz(DLookup("SURVIVE", "L05", "fldAgeOfAvgLife = " & number))
Case "EL05"
lookupBLDcurve = Nz(DLookup("EXPECT", "L05", "fldAgeOfAvgLife = " & number))
Case Else
lookupBLDcurve = -1
End Select
End Function
Thanks for your help.