Strip extra characters from text string for new ID

I have an ACCESS 2003 process that brings in claim data.  The claim id is prefixed by three characters which need to be ignored, then the next string of characters to the first space need to be appended to a prefix the database recognizes.  The number of charactesr after the first three can vary so I cannot simply grab so many characters after character 3 in the string.

For example, the string "9113256987 some claim" needs to ultimately be "RDB_3256987".

Sandra
Sandra SmithRetiredAsked:
Who is Participating?
 
lee555J5Commented:
NewString = Left(PrefixString, 3) & "_" & Mid(ClaimID, 4, InStr(ClaimID, " ") - 1)

Lee
0
 
hnasrCommented:
Following your example: if strString="9113256987"

newString= "RDB_"& right(strString,len(strString)-3)
0
 
Sandra SmithRetiredAuthor Commented:
hnasr, problem is the first characters are in a string of a description so I need to stop at the first space in the string.  As in the example, the descritpions can be:

"9113256987 some claim"

Thus, the first characters can be any length, so I need to determine the position of the space.

Sandra
0
 
Sandra SmithRetiredAuthor Commented:
That was it, I needed to determine where the space was.  Thank you.

Sandra
0
 
hnasrCommented:
Correction:
Following your example: if strString = "9113256987 some claim"

newString = "RDB_"& val(right(strString,len(strString)-3))
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.