[AccessD] String - strip off leading zeros

Jennifer Gross jengross at gte.net
Tue Jul 29 14:33:47 CDT 2008


Brilliant Lambert.  Thank you.

Jennifer 

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Heenan, Lambert
Sent: Tuesday, July 29, 2008 10:09 AM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] String - strip off leading zeros

This will do the trick...

Function StripLeadingZeros(strData As String) As String Dim n As Long
    If Left(strData, 1) = "0" Then
        StripLeadingZeros = StripLeadingZeros(Mid(strData, 2))
    Else
        StripLeadingZeros = strData
    End If
End Function

Lambert 

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Jennifer Gross
Sent: Tuesday, July 29, 2008 2:43 PM
To: 'Access Developers discussion and problem solving'
Subject: [AccessD] String - strip off leading zeros

Good Morning,

Does anyone have a quick function for stripping off leading zeros on a
string.  I am working with product codes, getting data from different
sources, some use leading zeros - anywhere from 1 to 5.  So, depending on
which source the data came from, the same product code could be represented
as 

1234ABC
01234ABC
001234ABC
0001234ABC
etc.

Thanks in advance,

Jennifer


--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com
--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com





More information about the AccessD mailing list