Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Deleting a variable amount at the end of a field 1

Status
Not open for further replies.

vb4me

Programmer
Nov 27, 2001
48
US
Hello,

I need to delete an amount off the end of a field. The amount deleted is variable. So I could have :

description 0.01
description 0.101
description 0.1001
etc.

It is always going to be 0.**** ( although on rare occasions it maybe 1.*****)- it will always have the . in it though.

I need to be left with just description.

I have the following working :
desc = left(desc, len(desc) - 4)

the problem there is it is set to 4 digits and I need it variable - any ideas would be appreciated.

Thanks
 
Hope this suggestion helps Im sure theres many other ways

Dim x As Long, mystring as string, newstring As String

mystring = "description 0.0000"
For x = Len(mystring) To 1 Step -1
If Mid(mystring, x, 1) = "." Then Exit For
Next
If x < 3 Then
'code here just incase ???
Else
newstring = Left(mystring, x - 3)
End If

cjw
 
Thanks very much - that worked perfectly
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top