Need help in Syntax

  • Thread starter Thread starter Me
  • Start date Start date
M

Me

How do I extract portion of data from a field delimited by say '/'?

Example if I have - 'abcdef/ijk/efdfdfd' or 'xyz/dfdfd'

I would like to get 'abcdef' in 1st case and 'xyz' in the 2nd case.

Thank you in advance,
-Me
 
Karl,

This works, however I forgto to add that there are records without any "/"
in the data, how do I handle both together?

Like 'abcd/efg' and 'xyzabcedfe'

so I should be able to retrieve 'abcd' and 'xyzabcedfe'.

Appreciate your help!
-Me

KARL DEWEY said:
Left([YourField], Instr([YourField],"/")-1)


Me said:
How do I extract portion of data from a field delimited by say '/'?

Example if I have - 'abcdef/ijk/efdfdfd' or 'xyz/dfdfd'

I would like to get 'abcdef' in 1st case and 'xyz' in the 2nd case.

Thank you in advance,
-Me
 
IIF(Instr([YourField],"/")<0, [YourField], Left([YourField],
Instr([YourField],"/")-1)


Me said:
Karl,

This works, however I forgto to add that there are records without any "/"
in the data, how do I handle both together?

Like 'abcd/efg' and 'xyzabcedfe'

so I should be able to retrieve 'abcd' and 'xyzabcedfe'.

Appreciate your help!
-Me

KARL DEWEY said:
Left([YourField], Instr([YourField],"/")-1)


Me said:
How do I extract portion of data from a field delimited by say '/'?

Example if I have - 'abcdef/ijk/efdfdfd' or 'xyz/dfdfd'

I would like to get 'abcdef' in 1st case and 'xyz' in the 2nd case.

Thank you in advance,
-Me
 
Easy way to to append a slash to the end of the field in the Instr function:

Left([YourField], Instr([YourField] & "/","/")-1)


'====================================================
John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
'====================================================

Karl,

This works, however I forgto to add that there are records without any "/"
in the data, how do I handle both together?

Like 'abcd/efg' and 'xyzabcedfe'

so I should be able to retrieve 'abcd' and 'xyzabcedfe'.

Appreciate your help!
-Me

KARL DEWEY said:
Left([YourField], Instr([YourField],"/")-1)


Me said:
How do I extract portion of data from a field delimited by say '/'?

Example if I have - 'abcdef/ijk/efdfdfd' or 'xyz/dfdfd'

I would like to get 'abcdef' in 1st case and 'xyz' in the 2nd case.

Thank you in advance,
-Me
 
Back
Top