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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top