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. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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 | |
|
|