trim function

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am trying to remoove characters from a text field such as "-". The
characters are in multiple spots in the field example 30GTN080---5--KA I
want to left justify the numbers and letters without any "-". How can I use
the trim function to do this?

Thanks
 
tony8659 said:
I am trying to remoove characters from a text field such as "-". The
characters are in multiple spots in the field example
30GTN080---5--KA I want to left justify the numbers and letters
without any "-". How can I use the trim function to do this?

Thanks

You can't. Trim is only for removing leading or trailing spaces.

Check Help for the Replace() function. It can do what you want.
 
you don't use the trim function for this purpose, it is for removing leading
and trailing spaces

Dim strtest As String
dim strNew as string
strtest = "12122--21212122--22222"
strNew = Replace(strtest, "-", "")
MsgBox strNew

Should do the trick
 
Back
Top