Solved

how to split text in access into 2 fields

Posted on 2009-04-07
3
735 Views
Last Modified: 2012-05-06
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
Comment
Question by:karinos57
3 Comments
 
LVL 92

Accepted Solution

by:
Patrick Matthews earned 250 total points
ID: 24088573
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
 
LVL 119

Expert Comment

by:Rey Obrero
ID: 24088591


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

Author Closing Comment

by:karinos57
ID: 31567580
this is perfect
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
These days, all we hear about hacktivists took down so and so websites and retrieved thousands of user’s data. One of the techniques to get unauthorized access to database is by performing SQL injection. This article is quite lengthy which gives bas…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

910 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now