Solved

eliminating numbers in a text field with formula in a query (MS Access)

Posted on 2014-02-05
7
470 Views
Last Modified: 2014-02-05
I have a field with values like the followings:

Banc of America Funding  2006-A Trust
Banc of America Funding  2004-2 Trust

What formula can I use in an access query to just retain

Banc of America Funding?
0
Comment
Question by:fitaliano
[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
  • 3
  • 2
  • 2
7 Comments
 

Author Comment

by:fitaliano
ID: 39836164
In other words, I want to truncate the filed as soon as the number starts
0
 
LVL 37

Expert Comment

by:PatHartman
ID: 39836180
If all you have to worry about is year's that start with 2, then

Left(yourfield, instr(yourfield, "2") -2)

The expression uses instr() to find the "2" and then subtracts 2 to get the length of the string to extract.
0
 
LVL 30

Expert Comment

by:hnasr
ID: 39836341
Are you asking for just a query?
0
Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

 

Author Comment

by:fitaliano
ID: 39836370
it works but I get a #Func! error for fields without numberic values
0
 
LVL 37

Accepted Solution

by:
PatHartman earned 500 total points
ID: 39836409
IIf(instr(yourfield, "2")  = 0, yourfield, Left(yourfield, instr(yourfield, "2") -2))
0
 
LVL 30

Expert Comment

by:hnasr
ID: 39836456
Here is a query for first digit 0, 1, 2, or 3. Modify query if higher digits are involved.
For table a (adesc)

SELECT adesc,
left(replace(replace(replace( replace(adesc,"0","9"),  "1","9"),"2","9"),"3","9"),
instr(replace(replace(replace( replace(adesc,"0","9"),  "1","9"),"2","9"),"3","9"), "9")-1)
FROM a

Open in new window


You may need to check for null values.
0
 

Author Closing Comment

by:fitaliano
ID: 39836579
Thank you
0

Featured Post

Industry Leaders: 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

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.
This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
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, when working with VBA, learn some techniques for writing readable and easily maintained code.

734 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