Solved

MS Access - parsing a string every 3 characters

Posted on 2014-10-01
3
281 Views
Last Modified: 2014-10-01
I'm a fairly novice MS Access user, but I'll bet this is an easy one for most of you.

I have a value in a column that I want to parse into 3 columns. There is no delimiter, but I want every 3 characters...

Source Data:  ABC123xyz987

Goal:
Field1: ABC
Field2: 123
Field3: xyz
Field4: 987

Can you write me a little function for that, please?
0
Comment
Question by:P-Daddy
  • 2
3 Comments
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 500 total points
ID: 40355849
you can do this in a query

select [Source Data],  Left([Source Data], 3) as Field1, Mid([Source Data], 4, 3) as Field2, Mid([Source Data], 7, 3) as Field3, Right([Source Data], 3) as Field4
from TableName
0
 

Author Comment

by:P-Daddy
ID: 40355892
This worked perfectly - thanks!

I had to make one minor tweak to replace the Right with a Mid starting at position 10. Here's my final...

SELECT [qry_1_Assortment_Wide_Open]![CATOP] AS Expr1, Left([qry_1_Assortment_Wide_Open]![CATOP],3) AS 1, Mid([qry_1_Assortment_Wide_Open]![CATOP],4,3) AS 2, Mid([qry_1_Assortment_Wide_Open]![CATOP],7,3) AS 3, Mid([qry_1_Assortment_Wide_Open]![CATOP],10,3) AS 4
FROM qry_1_Assortment_Wide_Open;
0
 

Author Closing Comment

by:P-Daddy
ID: 40355894
Rey Obrero, you were a life saver - thanks!
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Technology opened people to different means of presenting information, but PowerPoint remains to be above competition. Know why PPT still works today.
It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
The viewer will learn how to simulate a series of sales calls dependent on a single skill level and learn how to simulate a series of sales calls dependent on two skill levels. Simulating Independent Sales Calls: Enter .75 into cell C2 – “skill leve…
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…

856 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