Solved

how to split text in access into 2 fields

Posted on 2009-04-07
3
734 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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
Many companies are looking to get out of the datacenter business and to services like Microsoft Azure to provide Infrastructure as a Service (IaaS) solutions for legacy client server workloads, rather than continuing to make capital investments in h…
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

757 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

19 Experts available now in Live!

Get 1:1 Help Now