Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 751
  • Last Modified:

how to split text in access into 2 fields

Hi,
I have a field like the following:
4mg/Acc
3mgkl/Mllpr
LLMN/Gkoh

So all what i want to do is that split the text into 2 fields starting the "/".  Here is the result that i would like to see:
field1               field2
4mg                 Acc
3mgkl               Mllpr
LLMN              Gkoh

Thanks.
0
karinos57
Asked:
karinos57
1 Solution
 
Patrick MatthewsCommented:
SELECT SomeField, IIf(InStr(1, SomeField, "/") > 0, Left(SomeField, InStr(1, SomeField, "/") - 1), SomeField) AS FirstPart,
    IIf(InStr(1, SomeField, "/") > 0, Mid(SomeField, InStr(1, SomeField, "/") + 1), "") AS SecondPart
FROM SomeTable
0
 
Rey Obrero (Capricorn1)Commented:


select Left([f1],instr([f1],"/")-1) as field1,
mid([f1],instr([f1],"/")+1) as field2
from tableX
where Instr([f1],"/")>0
0
 
karinos57Author Commented:
this is perfect
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now