Solved

How to trim spaces in captured data on some fields ?

Posted on 2009-07-15
8
292 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
  • 5
8 Comments
 
LVL 75

Accepted Solution

by:
DatabaseMX (Joe Anderson - Access MVP) 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
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 
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

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

QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
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…

912 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

21 Experts available now in Live!

Get 1:1 Help Now