Solved

MS Access - parsing a string every 3 characters

Posted on 2014-10-01
3
276 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 119

Accepted Solution

by:
Rey Obrero 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

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

Suggested Solutions

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
User Beware!  This is a rather permanent solution to removing your email from an exchange server.  The only way to truly go back is to have your exchange administrator restore your mailbox from backups.  This is usually the option of last resort.  A…
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…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

863 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

26 Experts available now in Live!

Get 1:1 Help Now