leading space in a combo box

M

MEOlsen

I have several combo boxes with common phrases that concatenate into a memo
field. This works fine except for one problem: even though I have included a
trailing space inside the quotation marks of the data list entries, when the
strings are selected and put together the spaces are deleted. Is there a way
to prevent this?
 
A

Al Camp

I'd first suggest dropping the trailing space from your phrases, and
insert them during the concatenation.
= Phrase1 & " " & Phrase2 & " " & etc...

Or... instead of a space at the end of phrases, use the extended ascii
character Alt-0160. Hold the Alt key, and type 0160 on the num pad. In
most common fonts, this is an "empty" character, which Access will not
recognize as a "trailing space", and will not drop it.
I use this method on the end of my text control label captions, to offset
the caption one space left, so label and text fields (butted up and aligned
to each other) will still show a space between them for "readability".
 
J

John Vinson

I have several combo boxes with common phrases that concatenate into a memo
field. This works fine except for one problem: even though I have included a
trailing space inside the quotation marks of the data list entries, when the
strings are selected and put together the spaces are deleted. Is there a way
to prevent this?

It would help if you would post your code. I'm *guessing* that the
problem is that Access trims trailing blanks when you store a string
in a table. I'd try concatenating the blank as a literal character, by
putting & " " after the selection from the combo.

John W. Vinson[MVP]
 
J

John Vinson

Or... instead of a space at the end of phrases, use the extended ascii
character Alt-0160. Hold the Alt key, and type 0160 on the num pad. In
most common fonts, this is an "empty" character, which Access will not
recognize as a "trailing space", and will not drop it.

<boinnnnnnggggg...>

Thanks, Al. I was NOT aware of that neat little trick, and I've had
lots of hassles getting around it!

John W. Vinson[MVP]
 
R

Rob Oldfield

John Vinson said:
<boinnnnnnggggg...>

Thanks, Al. I was NOT aware of that neat little trick, and I've had
lots of hassles getting around it!

John W. Vinson[MVP]

The problem with that is, I think, that that's a non-breaking space - at
least, that's what chr(160) gives you. If you go down this road then you
might need to use a replace function to switch the chr(160)s back to
breaking spaces before using the field on a report (or wherever).
 
A

Al Camp

Rob,
I don't use the Alt-0160 in any data field, usually just in labels.

My first solution...
I'd first suggest dropping the trailing space from your phrases, and
insert them during the concatenation.
= Phrase1 & " " & Phrase2 & " " & etc...
would be the preferred method.

But... I agree... imbedded in textual data, with concatenation, there
might be a problem a problem on "breaking."

Thanks for the input..
--
hth
Al Camp
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions
 
M

MEOlsen

Many thanks. I did think of adding a space to the string ( & " ") as you say,
but I wanted to know about a "hard space" too.

Cheers!
 
S

StargateFan

Many thanks. I did think of adding a space to the string ( & " ") as you say,
but I wanted to know about a "hard space" too.

I just saw this thread.

Is there a problem using a space in a combo box?

I added a space in front of a couple of names in a box so that the
person who inputs the most just has to type in the first letter of her
name to get her name to pop up? She'll enter up to a hundred a day
whereas the other name in the list is no longer even with us. It was
a hassle for the new person to have to type 5 letters for her name to
come up. This way saves a lot of time. But perhaps instead of a
space, from the sound of this thread, an "empty" character such as
described here might be best?

It's unlikely we'll ever really need to sort by employee for this
particular db, but just wanting to understand the possible objections
to a leading space.

Thanks. :eek:D
 
Top