?
Solved

Truncate data

Posted on 2011-10-26
7
Medium Priority
?
289 Views
Last Modified: 2012-05-12
Experts,
In the code below I would like to be able to truncate the first 11 characters from the field StoreName
Store: "Store # " & [StoreNumber] & " " & [StoreName]
 & " , " & [StoreAddressOne]

Open in new window

0
Comment
Question by:Frank Freese
7 Comments
 
LVL 61

Expert Comment

by:mbizup
ID: 37030790
Try this:

"Store # " & Right([StoreNumber], Len([StoreNumber]) - 11)  & " " & [StoreName]
 & " , " & [StoreAddressOne]
0
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 1600 total points
ID: 37030797

to get the first 11 characters

Store: "Store # " & [StoreNumber] & " " & Left([StoreName],11)
 & " , " & [StoreAddressOne]

to remove the first 11 characters and select from 12 character and on

Store: "Store # " & [StoreNumber] & " " & Mid([StoreName],12)
 & " , " & [StoreAddressOne]
0
 
LVL 61

Assisted Solution

by:mbizup
mbizup earned 200 total points
ID: 37030803
So this part does the actual truncation:

 Right([StoreNumber], Len([StoreNumber]) - 11)
0
 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

 

Author Comment

by:Frank Freese
ID: 37030807
got an invalid sql statement
0
 
LVL 61

Expert Comment

by:mbizup
ID: 37030824
Store: "Store # " & [StoreNumber] & " " & Right([StoreName], Len([StoreName]) - 11)
 & " , " & [StoreAddressOne]
0
 
LVL 49

Assisted Solution

by:Dale Fye
Dale Fye earned 200 total points
ID: 37030865
The Right( ) syntax mentioned by mbizup will fail if the length of the storename is < 11.  For that reason, I prefer to use the Mid( ) syntax recommended by capricorn1.
0
 

Author Closing Comment

by:Frank Freese
ID: 37030883
thank you
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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

Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
Instead of error trapping or hard-coding for non-updateable fields when using QODBC, let VBA automatically disable them when forms open. This way, users can view but not change the data. Part 1 explained how to use schema tables to do this. Part 2 h…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

840 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