Hi Paul & orcinus
I was curious also, so I tried to get the code to using NULL. No Luck. I found this in Help:
Expressions that you might expect to evaluate to
True under some circumstances, such as If Var = Null and If Var <> Null, are always
False.
This is because any expression containing a Null is itself Null and, therefore, False.
So, even in the Select Case, comparing Null (in lang) to Case NULL will result in NULL (False).
I did come up with a couple of work arounds:
1) Test for NULL before the case statements:
Code:
Function fcnConvLang(Lang As Variant) As String
If IsNull(Lang) Then
fcnConvLang = "BLANK"
End If
Select Case Lang
Case "CANTONESE"
fcnConvLang = "CHINESE"
Case "MANDARIN"
fcnConvLang = "CHINESE"
Case "ENGLISH"
fcnConvLang = "OTHER"
Case "JAPANESE,NIHONGO"
fcnConvLang = "OTHER"
End Select
End Function
2) Check for NULL in the calling statement and changing "Lang" from a Variant to a String:
txtReturn = fcnConvLang(nz(txtEntry, "Is_Null"))
Code:
Function fcnConvLang(Lang As String) As String
Select Case Lang
Case "CANTONESE"
fcnConvLang = "CHINESE"
Case "MANDARIN"
fcnConvLang = "CHINESE"
Case "ENGLISH"
fcnConvLang = "OTHER"
Case "JAPANESE,NIHONGO"
fcnConvLang = "OTHER"
Case "Is_Null"
fcnConvLang = "BLANK"
Case Else
fcnConvLang = "BLANK"
End Select
End Function