View Full Version : Remove spaces between text


Jeanette
12-24-2001, 07:31 AM
Hello
How do I remove spaces between text that is concatenated. I tried using LTrim and RTrim but that did not work. Here is the expression I am currently using: Trim([Buildings_Crosstab]![1] & " " & [Buildings_Crosstab]![2] & " " & [Buildings_Crosstab]![3] & " " & [Buildings_Crosstab]![4] & " " & [Buildings_Crosstab]![5] & " " & [Buildings_Crosstab]![6] & " " & [Buildings_Crosstab]![7] & " " & [Buildings_Crosstab]![8] & " " & [Buildings_Crosstab]![9] & " " & [Buildings_Crosstab]![10] & " " & [Buildings_Crosstab]![11] & " " & [Buildings_Crosstab]![12] & " " & [Buildings_Crosstab]![14] & " " & [Buildings_Crosstab]![16] & " " & [Buildings_Crosstab]![17])

Jack Cowley
12-24-2001, 08:32 AM
Trim([Buildings_Crosstab]![1]) & " " & Trim([Buildings_Crosstab]![2]) & " " & Trim([Buildings_Crosstab]![3]) & " " & Trim([Buildings_Crosstab]![4]).......

[This message has been edited by Jack Cowley (edited 12-24-2001).]

Jeanette
12-27-2001, 08:34 AM
Are you telling me to use the Trim() function to remove spaces between strings of text? If you are, I am currently using the Trim() function, but the spaces are not removed.

Jack Cowley
12-27-2001, 09:11 AM
The Trim() function removes leading and trailing spaces from a string. The code that I am suggesting (Trim([Buildings_Crosstab]![1])) would remove leading and trailing spaces from the string [Building_Crosstab]![1], etc. The code you are using will remove the leading and trailing spaces from your concatenated string only. You have added spaces in your concatenation by using the & " " & to concatenated your string. If these are the spaces you are wanting to remove then Trim([Buildings_Crosstab]![1] & [Buildings_Crosstab]![2] & [Buildings_Crosstab]![3] & .... should do the trick.

If [Buildings_Crosstab]![1] contains a string like "Now is the time" and you want to remove the space in that string then you will need to use code to remove the spaces before you do your concatenation or you will need to run the code after the concatenation.

hth,
Jack

[This message has been edited by Jack Cowley (edited 12-27-2001).]

Jeanette
12-27-2001, 09:43 AM
I did what you recommended and it worked.
Thank you very much.

Jack Cowley
12-27-2001, 10:33 AM
You are very welcome!