removing leading spaces
RH

Forum home » Delegate support and help forum » Microsoft Access Training and help » Removing leading spaces

Removing leading spaces

resolvedResolved · Medium Priority · Version 2007

Edited on Thu 19 Jul 2012, 16:35

Andrew has attended:
Access Intermediate course
Access Advanced course

Removing leading spaces

Hi i'm importing external data from excel into access and a number of the fields in the excel file contain spaces infront of the cell contents. How can i remove these spaces once i have imported the data into access. The data is going to change everytime as the excel sheet is exported from a seperate programme. At present there are approximately 20 fields that all have leading spaces and there is no way to edit the excel file prior to importing the data.

Thank you for any assistance you may be able to provide. N.B. I have reason to believe that these are not leading spaces so the trim function will not work.

RE: Removing leading spaces

Hello Andrew,

Hope you enjoyed your Microsoft Access courses with Best STL.

Thank you for your question regarding removing leading spaces from data imported from Excel.

The spaces in the Excel data may simply be Indented data which gives the appearance of having spaces. If this is the case then the TRIM function in Excel will remove indents as well as leading and trailing spaces.

I presume that you have already tried this in Excel?

What I would do is first try the TRIM function in Excel to see if this works. If it does I would then create a macro to automate the process over the many columns you have in the sheet.

Should this fail to work and your only choice is to remove the spaces in Access I have added some links to resources that may be of use to you. These are as follows:

http://www.utteraccess.com/forum/Remove-Extra-Spaces-Str-t1970618.html

http://office.microsoft.com/en-ca/access-help/remove-spaces-from-the-beginning-and-end-of-a-text-value-HP001099033.aspx

http://www.techonthenet.com/access/functions/string/trim.php

Give these a try. I'm sure you will be able to fix the problem one way or another.

Have a great weekend!


I hope this resolves your question. If it has, please mark this question as resolved.

If you require further assistance, please reply to this post. Or perhaps you have another Microsoft Office question?

Have a great day.
Regards,

Rodney
Microsoft Office Specialist Trainer

Thu 26 Jul 2012: Automatically marked as resolved.

 

Training courses

 

Training information:

See also:

Welcome. Please choose your application (eg. Excel) and then post your question.

Our Microsoft Qualified trainers will then respond within 24 hours (working days).

Frequently Asked Questions
What does 'Resolved' mean?

Any suggestions, questions or comments? Please post in the Improve the forum thread.


 

Access tip:

Related tables

When you have related tables such as Customers and their Orders, the Customer table is the Primary table.

Open the Customers table in datasheet view and go to the Home Tab and Records group. Click on the More option and choose Subdatasheet and then click on Subdatasheet again. Now choose the related table (Orders) and click ok.

Now you can click the + symbol by each company to show the related orders.

View all Access hints and tips


Server loaded in 0.06 secs.