Remove #Type! when no parameters

Chaga

Member
Local time
Today, 21:27
Joined
Aug 19, 2022
Messages
34
Hello everyone, I found a function online that returns years/months/days for a date difference, and using it in a form to give me a contract duration between 2 dates.
But the result textbox displays #Type! before entering the dates, how do I keep it blank instead?
Am pretty sure it's quite simple, but having a brain fart at the moment.
TIA
 
set the Return value of the function to Variant, example:

public function fnDuration(byval dte1 As Variant, byval dte2 As Variant) As Variant
fnDuration = Null
If IsNull(dte1) Or IsNull(dte2) Then
Exit function
End if
' rest of you computation below
'
end function
 
set the Return value of the function to Variant, example:

public function fnDuration(byval dte1 As Variant, byval dte2 As Variant) As Variant
fnDuration = Null
If IsNull(dte1) Or IsNull(dte2) Then
Exit function
End if
' rest of you computation below
'
end function
Cheers mate.
 

Users who are viewing this thread

Back
Top Bottom