Strings have a Length property, so just check that. This is what I would use
for the function:
If IsNothing(varNullText) OrElse varNullText.Length = 0 Then
Return Nothing
Else
return varNullTest
End If
Of course this will return a VB reference of nothing, my guess is that you
were trying to return something you could use to set a database value to
NULL. A database null, and a variable referencing nothing, are completely
unrelated things in .NET. If this was the purpose of this function, you
would have to modify it to be of return type Object, and return a
DBNull.Value in case the string tested for empty.
"Steven K" <sk****@troop.com> wrote in message
news:O7**************@tk2msftngp13.phx.gbl...
Hello,
I have the following function that I am migrating from ASP, but I am
getting the following error: Name 'Len' is not declared.
Any help with this would be appreciated.
Public Function vba_Null_Value(varNullTest As String) As String
If Len(varNullTest) = 0 Then
Return NULL
Else
Return varNullTest
End If
End Function
--
Thanks in advance,
Steven