Deleting a Asterisk from a string

Kango

Registered User.
Local time
Yesterday, 20:37
Joined
Mar 11, 2004
Messages
29
Hi All

I have a table with names of machine parts ( which have been imported from another db) only problem is some records have '*" at the end which i want to delete. How can i search for and '*' and then delete it from the string so for example:

Record 1 = 'Bolts*' Should be 'Bolts'
Record 2 = *Jig should be 'Jig'


Would be grateful for some help here please
 
Dim li_Instr as Integer
Dim str_Searchstring as String
Dim str_Start as String
Dim str_End as String
Dim str_Final as String

str_SearchString = "12345*789"

li_Instr = Instr(1, str_SearchString, "*")

' ----- li_Instr would equal 6. -------

str_Start = Left(str_SearchString, li_Instr - 1)
'----- str_Start would equal "12345"

str_End = Right(str_SearchString, li_Instr + 1)
'----- str_End would equal "789"

str_Final = str_Start & str_End
'-----str_Final would equal "12345789"
 
yikes! that's overkill.
Just do this

var=replace(strVal,"*","")
 
Hey,

Thanks for the speedy reply. Work's fantastically !

Much Appreciated !!!
 

Users who are viewing this thread

Back
Top Bottom