A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

trim to first "-" character



 
 
Thread Tools Display Modes
  #1  
Old December 13th, 2009, 07:58 PM posted to microsoft.public.access
Keith
external usenet poster
 
Posts: 531
Default trim to first "-" character

Sorry if this is posted again, but I couldn't find my post.

How do I trim off everything to the left of the first "-"? The number of
spaces are different (to the left of the first "-") so I'm hoping there's a
way. There's always a way!


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

Results would be:
PLhagdr-hdk
GHld-usj
hgrh-isjb
  #2  
Old December 13th, 2009, 08:11 PM posted to microsoft.public.access
xps35
external usenet poster
 
Posts: 22
Default trim to first "-" character

On 13 dec, 20:58, Keith wrote:
Sorry if this is posted again, but I couldn't find my post.

How do I trim off everything to the left of the first "-"? The number of
spaces are different (to the left of the first "-") so I'm hoping there's a
way. There's always a way!

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

Results would be:
PLhagdr-hdk
GHld-usj
hgrh-isjb


Mid([YourField],InStr([YourField],"-")+1)

Groeten,

Peter
http://access.xps350.com
  #3  
Old December 13th, 2009, 08:26 PM posted to microsoft.public.access
Linq Adams via AccessMonster.com
external usenet poster
 
Posts: 1,474
Default trim to first "-" character

The general expression would be

Mid(FieldName, Instr(FieldName,"-")+1)

--
There's ALWAYS more than one way to skin a cat!

Answers/posts based on Access 2000/2003

Message posted via http://www.accessmonster.com

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 06:54 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.