Solved

How to trim spaces in captured data on some fields ?

Posted on 2009-07-15
8
296 Views
Last Modified: 2012-05-07
HI

We have imported some data to an access table but it seems that some fields have some spaces at right and left side.

I wonder if there´s an access function that could trim those spaces.

Thanks in advance.
0
Comment
Question by:dimensionav
[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
  • 5
8 Comments
 
LVL 75

Accepted Solution

by:
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform) earned 250 total points
ID: 24866352

Trim(yourFieldName)

mx
0
 
LVL 4

Assisted Solution

by:mysteriousguy
mysteriousguy earned 250 total points
ID: 24866353
There are 3 functions doing this.
LTrim trims the left spaces
RTrim trims the right spaces
Trim trims left and right spaces

So you could update yout table like this:
UPDATE table set column = Trim(column)

http://www.techonthenet.com/access/functions/string/trim.php
http://www.techonthenet.com/access/functions/string/ltrim.php
http://www.techonthenet.com/access/functions/string/rtrim.php
0
 
LVL 75
ID: 24866363
For example ... using an Update query:

UPDATE Table1 SET Table1.FIELD1 = Trim([FIELD1]), Table1.FIELD2 = Trim([FIELD2]), Table1.FIELD3 = Trim([FIELD3]);


mx
0
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 
LVL 75
ID: 24866457
I posted the correct answer first - followed by an example.

mx
0
 

Author Comment

by:dimensionav
ID: 24866500
I´m very sorry DatabaseMX, I just saw the mysteriousguy example first, I haven´t noticed your next example after trying mysteriousguy one.

What would you like I do ?
Regards
0
 
LVL 75
ID: 24866506
Click the Request Attention button ... the mods will help you.

thx
0
 
LVL 75
ID: 24906447
thx.
Appreciate this.

mx
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

A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
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.
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.

696 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