Solved

How to split a field into two columns in a Query

Posted on 2016-10-12
6
51 Views
Last Modified: 2016-10-13
I want to be able to via a query parse a single column  Claim No (123456789-001) into two separate fields in the resulting worksheet.

So the first 9 characters and then the number to the right of the "-"
0
Comment
Question by:seamus9909
[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
6 Comments
 
LVL 38

Expert Comment

by:PatHartman
ID: 41841104
You need to use the left() and right() functions

Select Left([Claim No], 9) as ClaimNo, Right([Claim No], 3) as ClaimSuffix From YourTable
0
 

Author Comment

by:seamus9909
ID: 41841125
Its telling syntax is not correct.  I am using Query Design and not the SQL itself.

am I missing the quote or bracket?
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 41841137
<I am using Query Design and not the SQL itself.>

post an image of your query
0
NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

 
LVL 29

Expert Comment

by:Pawan Kumar
ID: 41841256
Pls try.. Also check the name of the column - [Claim No].

1.
left(x,instr([Claim No],"-")-1)
trim(mid(([Claim No],instr(([Claim No],"-")+1))

2.
trim(split(([Claim No],"-")(0))
trim(split(([Claim No],"-")(1))
0
 
LVL 23

Accepted Solution

by:
Ferruccio Accalai earned 500 total points
ID: 41841500
In Query Design, write into the Field Option
LeftField: Left([Claim No],9)

Open in new window

This is the first field that will be selected with Alias LeftField (of course you can use your preferred name)
Then the other field will be
RightField: Right([Claim No],3)

Open in new window

Example
0
 

Author Closing Comment

by:seamus9909
ID: 41841798
Thank you so much!
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

As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
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…
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…

635 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