I have on ongoing struggle with empty strings vs. null. I've learned a bit over time, but they look the same and of course behave differently. I have written a function to check for both a null and an empty string, "". and then return a substitute value like the NZ function. I'm not sure if it's necessary, but it solves a problem I was having with an empty combo box on my form. NZ was not working so I wrote this.
I've seen other developers do similar things. This function works in place of NZ. Does Access have something built in like this? I'd appreciate your comments.Code:Public Function NZ_Empty(varString As Variant, strSubstitute As String) If IsNull(varString) Or varString = "" Then NZ_Empty = strSubstitute Else NZ_Empty = varString End If End Function