Solved

how to use trim in access 2013 to cut extra spaces

Posted on 2014-01-12
6
1,122 Views
Last Modified: 2014-01-12
hi

i have some strange problem that when i make with a query for example:
NSERT INTO IskitTemp ( ProductName ) Select ProductName From ProductTbl

Open in new window

i get a list with  all products name with extra spaces that increase the character in the productName field to  250 characters (like the Restriction of The maximum amount of characters that can stored in the product name in the producttbl, but in the producttbl it's dosn't have so much  spaces  so why in iskittemp is so much spaces ?
0
Comment
Question by:bill201
  • 3
  • 3
6 Comments
 
LVL 49

Expert Comment

by:Rgonzo1971
ID: 39774620
HI,

whitout more info about IsKitTemp

pls try

INSERT INTO Trim(IskitTemp ( ProductName ) )Select ProductName From ProductTbl 

Open in new window

Regards
0
 

Author Comment

by:bill201
ID: 39774634
there is something wrong in your code, it's not working and i get an error message
0
 
LVL 49

Expert Comment

by:Rgonzo1971
ID: 39774644
Hi,

What is Definition of Product Name In the ProductTbl?

EDIT Are you using VARCHAR(n)  because CHAR(n) will add blanks at the end?

INSERT INTO IskitTemp ( ProductName ) Select Trim(ProductName) From ProductTbl 

Open in new window


Regards
0
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 

Author Comment

by:bill201
ID: 39774648
i create it with sql string :

the Definition of Product Name In the ProductTbl is short text field size (255)

the iskttemp i create with a sql string like this
CREATE TABLE  (ProductName CHAR (255))

Open in new window

0
 
LVL 49

Accepted Solution

by:
Rgonzo1971 earned 500 total points
ID: 39774652
Hi,

With CHAR it adds Blank Space to create a 255 Character Long Field, pls use VARCHAR

Regards
0
 

Author Comment

by:bill201
ID: 39774657
thanks a lot, now there is no problem
0

Featured Post

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Creating and Managing Databases with phpMyAdmin in cPanel.
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.
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

810 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