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 » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

extract part of data



 
 
Thread Tools Display Modes
  #1  
Old August 17th, 2007, 12:44 PM posted to microsoft.public.access.forms
Bob Quintal
external usenet poster
 
Posts: 939
Default extract part of data

=?Utf-8?B?SkxX?= wrote in
:

from a datafield I need to extract a part of the text. the
items are seperated by a |
The datafield looks like:
|ab|cde|efg|
but number of characters can vary, but I always need the part
after the 3rd
|, in this case : efg

any help is welkom.

you can use the instr([start,]SearchIn,find[,comparemethod])
function to find each | and mid([string,start[,end]) to return
parts of it.

'put the string into a target variable
strTemp = !field

'now cut off the parts before your third
For x = 1 to 3
y = instr(strtemp,"|")
if y = 0 then
Msgbox "Field ls incomplete"
exit for
end if
strtemp = mid(strtemp,y +1)
next
'now remove any parts after the third.
y = instr(strtemp,"|")
if y 1 then
strtemp = mid(strtemp,1,y-1)
end if

--
Bob Quintal

PA is y I've altered my email address.

--
Posted via a free Usenet account from http://www.teranews.com

  #2  
Old August 17th, 2007, 12:58 PM posted to microsoft.public.access.forms
JLW
external usenet poster
 
Posts: 26
Default extract part of data

from a datafield I need to extract a part of the text. the items are
seperated by a |
The datafield looks like:
|ab|cde|efg|
but number of characters can vary, but I always need the part after the 3rd
|, in this case : efg

any help is welkom.


  #3  
Old August 17th, 2007, 01:45 PM posted to microsoft.public.access.forms
Douglas J. Steele
external usenet poster
 
Posts: 9,313
Default extract part of data

Split(StringValue, "|")(2)

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"JLW" wrote in message
...
from a datafield I need to extract a part of the text. the items are
seperated by a |
The datafield looks like:
|ab|cde|efg|
but number of characters can vary, but I always need the part after the
3rd
|, in this case : efg

any help is welkom.




  #4  
Old August 17th, 2007, 02:54 PM posted to microsoft.public.access.forms
JLW
external usenet poster
 
Posts: 26
Default extract part of data

Thanks, it works !

"Bob Quintal" wrote:

=?Utf-8?B?SkxX?= wrote in
:

from a datafield I need to extract a part of the text. the
items are seperated by a |
The datafield looks like:
|ab|cde|efg|
but number of characters can vary, but I always need the part
after the 3rd
|, in this case : efg

any help is welkom.

you can use the instr([start,]SearchIn,find[,comparemethod])
function to find each | and mid([string,start[,end]) to return
parts of it.

'put the string into a target variable
strTemp = !field

'now cut off the parts before your third
For x = 1 to 3
y = instr(strtemp,"|")
if y = 0 then
Msgbox "Field ls incomplete"
exit for
end if
strtemp = mid(strtemp,y +1)
next
'now remove any parts after the third.
y = instr(strtemp,"|")
if y 1 then
strtemp = mid(strtemp,1,y-1)
end if

--
Bob Quintal

PA is y I've altered my email address.

--
Posted via a free Usenet account from http://www.teranews.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 11:42 PM.


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