Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

RTrim problem - not removing trailing spaces

Status
Not open for further replies.

Terkle

Technical User
Jul 22, 2007
18
0
0
I imported a text field from Excel into an Access table. I tried to link it to another table in a query but it didn't work as the imported field has four spaces after the last character. I ran an update query using the RTrim$ function but it doesn't get rid of the spaces so I have to manually delete them. The text in the field is not the same length in each row otherwise I presume I could use the Left$ function??

Has anyone got any suggestions as to how I can clear these trailing spaces?

Thanks for any suggestions.
terkle
 
I think that you will find that the character is Ascii 255 or 160. You can find out and use Replace to remove it.

Code:
Sub WhichChar()
Dim rs As DAO.Recordset

Set rs = CurrentDb.OpenRecordset("ATable")

For i = 1 To Len(rs!AField)
Debug.Print Asc(Mid(rs!AFileld, i, 1))
Next
End Sub
 
Tut,

[tt]Debug.Print Asc(Mid(rs!AField, i, 1))[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top