Does anyone know the best way to remove a varying number of leading zeros from a table or query in MS Access 2000? These zeros occur at the beginning of a Address field's street number, and are followed by the number, and then by the street name.
Function RemoveLeadingChars(pstrText As String, _
pstrChar As String) As String
Dim intI As Integer
intI = 1
Do Until Mid(pstrText, intI, 1) <> pstrChar
intI = intI + 1
Loop
RemoveLeadingChars = Mid(pstrText, intI)
End Function
You can call this function in a query or control source or code.
Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
I'm trying to use your code here in an update query and keep getting the error undefined function 'removeleadingchars' in expression. Any ideas will be helpful
What have you done to implement the code? Did you paste the code into a standard module? Did you name the module something different from the function name?
Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.