Trim

  • Thread starter Thread starter Keith
  • Start date Start date
K

Keith

How do I trim off the far left characters up to a certain character, in this
case it would be the first "-". The first set of digits are different
length's up to the first "-". I hope that makes sense. See example.

Example:
(abc) -PLhagdr-hdk
(ded ) -GHld-usj
(ab) -hgrh-isjb

Results would be:

PLhagdr-hdk
GHld-usj
hgrh-isjb
 
(abc) -PLhagdr-hdk

Hi Keith,

You can use the Mid and Instr functions:

In a query,

MyTrimmedString: Mid([MyOriginalString],Instr([MyOriginalString], "-")
+1)

In VBA code:

MyTrimmedString = Mid(MyOriginalString,Instr(MyOriginalString, "-")
+1)

Hope this helps,

Armen Stein
Microsoft Access MVP
www.JStreetTech.com
 
Back
Top