Trim

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
 
A

Armen Stein

(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
 

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

Top