I figured it out!!
Private Sub Command1_Click()
Dim xnum As String
Dim mylen As Long
Dim Newlen As Long
Dim NewPnum As String
Dim OldPnum As String
OldPnum = Text1.Text
xnum = Right(OldPnum, 1)
If xnum = "X" Then
mylen = Len(OldPnum)
Newlen = mylen - 1
NewPnum = Left(OldPnum, Newlen)
Text1.Text = NewPnum
End If
End Sub
>I am trying to remove the letter X from a string that sometimes will appear in a text box. I am programming an automation app for a factory that sometimes has the letter X at the end of a part number. I want to strip the X off before I evaluate the part number to a database.
>
>Here is what I have tried. However, the result is only the letter X, which is what I want to get rid of. Any suggestions for this...?
>
>Thanks in advance.
>
>Private Sub Command1_Click()
>Dim xnum As String
>Dim mylen As Single
>Dim Newlen As Single
>Dim min1 As Single
>Dim NewPnum As String
>
>min1 = -1
>xnum = Right(Text1.Text, 1)
> If xnum = "X" Then
> mylen = Len(xnum)
> Newlen = mylen - min1
> NewPnum = Left(xnum, Newlen)
> Text1.Text = NewPnum
> End If
>
>End Sub
He is there and He is not Silent.