Solved

MS Access - parsing a string every 3 characters

Posted on 2014-10-01
3
287 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…

739 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