I have a text field which holds a street number with leading zeros for
sorting. I would like to trim the leading zeros to display on a form.
How about an alternative? Store the number as you would like it
displayed, and sort by Val([address]).
That said... here's some VBA code to trim leading zeros from any text
string:
Public Function TrimZeros(strIn As String) As String
Dim iPos As Integer
For iPos = 1 To Len(strIn)
If Mid(strIn, iPos, 1) <> "0" Then Exit For
Next iPos
TrimZeros = Mid(strIn, iPos)
End Function
Use =TrimZeros([address]) as the control source of your form control.
John W. Vinson[MVP]