Public Schedule Face-to-Face & Online Instructor-Led Training - View dates & book

removing leading spaces

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

Removing leading spaces

ResolvedVersion 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.

Access tip:

Create own ribbon tab - Access 2010

a. In Access click on the File tab
b. Select Options from left hand side
c. Choose the Customize Ribbon section
d. Click the New Tab button (below the list of tabs on the right hand side of the dialog box)
e. Select the New Tab (Custom) and enter a name, by clicking the Rename button (below the list of tabs on the right hand side of the dialog box)
f. Select the New Group (Custom) and enter a name, by clicking the Rename button (below the list of tabs on the right hand side of the dialog box)
g. Add commands to your tab and group by locating them on the list on the right hand side (remembering that you can change the list using the drop down box at the top of the list of commands) and clicking the Add button between the two panes to add them to your tab and group
h. You can rearrange the commands in your group, the groups on any tab or the tabs, using the up and down arrow buttons beside the list of tabs.
i. Click OK to apply your changes

View all Access hints and tips

Connect with us:

0207 987 3777

Call for assistance

Request Callback

We will call you back

Server loaded in 0.1 secs.