Jennifer Gross
jengross at gte.net
Tue Jul 29 14:57:21 CDT 2008
Lambert, You are not using n. Is there a reason why you Dim it? 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:54 AM To: 'Access Developers discussion and problem solving' Subject: Re: [AccessD] String - strip off leading zeros Of course I should have renamed the function... Any time. Here's an extension of the idea that can be used to strip any leading character you choose. Function StripLeadingChar(strData As String, strChar as String) As String Dim n As Long If Left(strData, 1) = strChar Then StripLeadingChar = StripLeadingChar(Mid(strData, 2)) Else StripLeadingChar = 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 3:34 PM To: 'Access Developers discussion and problem solving' Subject: Re: [AccessD] String - strip off leading zeros 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 -- 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