S
Santa-D
I'm using a simple VBA function to calculate the return date of a
vehicle, except where a value is null the result comes up as #ERROR and
when I try to do sort on the query I also get "Invalid use of null".
Previously I used this code which gave me the error above:
Function EDD(FinDate As Date, TERM As Double) As Date
If IsNull(TERM) Or IsNull(FinDate) Then
EDD = ""
Else
EDD = DateAdd("m", TERM, FinDate)
End If
End Function
If a vehicle did not have a date in the FinDate field it resulted in
#ERROR
I then tried the following and I still got the same error
Public Function EDDR(FinDate As Date, TERM As Double) As Date
EDDR = nz(DateAdd("m", TERM, FinDate), 0)
End Function
I also tried returning the 0 as "" and = Null, as all I want is the
field to be empty and able to sort it without any troubles.
vehicle, except where a value is null the result comes up as #ERROR and
when I try to do sort on the query I also get "Invalid use of null".
Previously I used this code which gave me the error above:
Function EDD(FinDate As Date, TERM As Double) As Date
If IsNull(TERM) Or IsNull(FinDate) Then
EDD = ""
Else
EDD = DateAdd("m", TERM, FinDate)
End If
End Function
If a vehicle did not have a date in the FinDate field it resulted in
#ERROR
I then tried the following and I still got the same error
Public Function EDDR(FinDate As Date, TERM As Double) As Date
EDDR = nz(DateAdd("m", TERM, FinDate), 0)
End Function
I also tried returning the 0 as "" and = Null, as all I want is the
field to be empty and able to sort it without any troubles.