Field Data

IanT

Registered User.
Local time
Today, 18:41
Joined
Nov 30, 2001
Messages
191
Hi

I have a field which will contain 10kg, 500g, 1ltr etc, how can I get code to ignore the numbers and us the letters!

Thanks in advance
 
Ian

If its the UoM you wish to return from the field each time then try the following:-

Dim strYourDataField As String

Dim strReturnedUoM As String

strYourDataField = "-1234.78kg"

strReturnedUoM = Right(strYourDataField, Len(strYourDataField) - CInt(Len(CStr(Val(strYourDataField)))))

'strReturnedUoM returns "kg"

Allan
 
Code:
Public Function GetText(ByVal strText As String) As String
    Dim strTemp As String
    Dim bytCounter As Byte
    For bytCounter = 1 To Len(strTemp)
        If Not IsNumeric(Mid(strTemp, bytCounter, 1) Then
            strTemp = strTemp & Mid(strTemp, bytCounter, 1)
        End If
    Next bytCounter
End Function
 

Users who are viewing this thread

Back
Top Bottom