Hey guys,
I wrote the following function to remove the "#" or "APT" from line 2 of an address (i.e. "APT 201" or "#201" goes to just "201").
Code:
Public Function AptName(Apt As String) As String
If Apt Like "APT *" Then
AptName = Right(Apt, Len(Apt) - 4)
Else
If Apt Like "[#]*" Then
AptName = Right(Apt, Len(Apt) - 1)
Else
AptName = Apt
End If
End If
End Function
That last bit, "AptName = Apt" was a recent addition to try to get rid of the #Errors I am getting.. but obviously it didn't work. The majority of the addresses in our system don't have a Line2 address. That field is null in those cases. I keep getting an #Error. Why? How can I fix this?