I want to obtain the lower_limit value searching from the table Threshold where it is stored but I'm always getting: "Error RunTime 94: Invalid use of Null value". I don't want the subroutine to give me back lower_limit, its only useful for the further step of SearchAbnormalities. I have checked the table Threshold (which PK is composed by ID_parInput, rangeagein, gender) and there is the row which corresponds to this selection.
Private Sub SearchAbnormalities(ByVal ID_parInput As Integer, ByVal gender As String, ByVal eta As Integer, Optional ByVal insertedSysValue As Integer, Optional ByVal insertedDiaValue As Integer, Optional ByVal measureValue As String)
Dim rangeagein As String
Dim lower_limit As Integer
Dim upper_limit As Integer
rangeagein = giveMeTheRange(eta)
Debug.Print ID_parInput, gender, rangeagein '>> 12, female, middle(31-60)
lower_limit = DLookup("lower_limit", "Threshold", "rangeage ='" & rangeagein & "' And ID_par = " & ID_parInput & " And gender = '" & gender & "'")
'...
End Sub