tisgreat
06-19-2007, 02:45 PM
If I have the following value in a cell:
Joe <100,894> Doe
Is there a function in Access that will clear out the <100,894> leaving me with Joe Doe? To my understanding the Replace function only can replace certain characters. How can I delete everything in between the < > as well?
Thanks,
Paul
pbaldy
06-19-2007, 02:52 PM
You can use the Left & Right functions, along with Instr and Len to peel out what's left of "<" and right of ">".
Moniker
06-19-2007, 02:58 PM
If what you are trying to remove is always between < and >, then it's simple.
strToConvert = "Joe <100,894> Doe"
strToConvert = Trim(Left(strToConvert, InStr(1,strToConvert,"<")-2)) & " " & Trim(Mid(strToConvert, InStrRev(strToConvert,">")+2))
The result of that is "Joe Doe".
tisgreat
06-21-2007, 11:20 AM
The only thing holding me back from using the left, right, mid, instr. approach is that there are several situations where I need to remove the brackets and the text between them. For example in one cell I have:
John <232,333> Doe Billy <23223234234234> Bob, Susy <323424234234abab> Q
In Excel I could simply do an alt edit replace using the * wildcard <*> but I don't know of as equally simple solution for Access??
Moniker
06-21-2007, 09:08 PM
What part of how to use left, right, mid, instr, etc. are you not getting? Have you looked at how replace works? When you have a string like your example, you loop through it. I'm not sure what part of the answer you're not getting.
Sorry if I'm coming off as harsh, but it almost looks like you're wanting an exact response instead of a nudge in the right direction.