Hi all,
I'm trying to write a simple function in Access VBA that I can use in a Jet SQL statement to return Null if a time value is greater than 20 hours (as this would have to be a data entry error).
I've got this far:
This works perfectly when passed a time but returns "#Error" if there is no time in the row (and therefore no MyTime). Clearly the IsNull element is not the right one to use.Code:Function Cln(MyTime As Date) If IsNull(MyTime) Then Cln = Null Else If MyTime > 0.833333333333333 Then Cln = Null Else Cln = MyTime End If End Function
Could anyone tell me how to handle instances where the value is missing in a custom access function as I've tried the standard Excel options (="", isNull, IsEmpty, is Nothing) and nothing seems to work.




Reply With Quote