• Strip Teaser (V2002)

    Author
    Topic
    #433432

    I cannot seem to pull together code to correctly strip leading zeroes from a string. cint( won’t work because the field can be alpha-numeric. The only characters I will need to strip will be all leading zeroes.
    Thanks!

    Viewing 0 reply threads
    Author
    Replies
    • #1019454

      You can paste the following function in a standard module:

      Public Function StripLeadingZeros(ByVal aValue As Variant) As Variant
      If IsNull(aValue) Then
      StripLeadingZeros = Null
      Else
      Do While Left(aValue, 1) = “0”
      aValue = Mid(aValue, 2)
      Loop
      StripLeadingZeros = aValue
      End If
      End Function

      Use this function in a query or in the control source of a text box. For example in a calculated field in a query:

      StrippedValue: StripLeadingZeros([FieldName])

    Viewing 0 reply threads
    Reply To: Strip Teaser (V2002)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: