When DLookup returns a null

  • Thread starter Thread starter Laurel
  • Start date Start date
L

Laurel

I would like this bit of code to work, but if there is nothing in
tblParameters that fits ls_where, I get an error "Invlid use of null"
Is there a way to make this work? The documentation said it returns a null
if it doesn't find a row, so why is this illegal?

ls_temp = DLookup("ParamValue", "tblParameters", ls_where)
If IsNull(ls_temp) Then
fncGetParameter = "Null"
Else
fncGetParameter = ls_temp
End If
 
Laurel said:
I would like this bit of code to work, but if there is nothing in
tblParameters that fits ls_where, I get an error "Invlid use of null"
Is there a way to make this work? The documentation said it returns
a null if it doesn't find a row, so why is this illegal?

ls_temp = DLookup("ParamValue", "tblParameters", ls_where)
If IsNull(ls_temp) Then
fncGetParameter = "Null"
Else
fncGetParameter = ls_temp
End If

What type is ls_temp? To set it to Null it has to be a variant.
 
Back
Top