455,487 Members | 1,747 Online
Need help? Post your question and get tips & solutions from a community of 455,487 IT Pros & Developers. It's quick & easy.

# How to delete unwanted characters from an address field

 P: 48 i have a table which contains an address field. i want to delete the zeros"0" "@" at the beginning of the address and i.e if i have "00312 @elm st" i want the result to be "312 elm st" here is my code. i call this function in my query but the result field is the same as the original field. the database is attached in the "out range error" thread Expand|Select|Wrap|Line Numbers Public Function StripDup(ByVal varWith As Variant) As String     Dim intX As Integer, intY, intZ As Integer     Dim strWith As String       If IsNull(varWith) Then         StripDup = ""         Exit Function     End If       StripDup = Trim(varWith)     varWith = Split(StripDup, " ")     For intX = 0 To UBound(varWith) Step 1         If Left(varWith(intX), 1) = "@" Then             varWith(intX) = LTrim(varWith(intX))         End If     Next intX       For intY = 0 To Len(varWith(0)) Step 1         If Left(varWith(0), 1) <> "0" Then Exit For Else varWith(0) = LTrim(varWith(0))     Next intY     StripDup = ""     For intZ = 0 To UBound(varWith)         StripDup = StripDup & " " & varWith(intZ)     Next intZ     StripDup = LTrim(StripDup) End Function Dec 7 '11 #1