How to use "&" in a label?

G

Guest

Storing and using special Chrs?

I’m attempting to use “&†in the value of a bound text field. It saves to
the table just fine. When assigning a value with this chr in a label it show
as “_â€. In the table, it shows the appropriate character “&â€, and, if I use
a msgBox() it will also show the “&†chr. The only time this appears to be a
problem is when I attempt to set the value of a label to a field value that
contains the “&†chr. How do I force the “&†to show in a label?

Thanks for any help you can provide.

Bernadou
 
D

Dirk Goldgar

bernadou said:
Storing and using special Chrs?

I'm attempting to use "&" in the value of a bound text field. It
saves to the table just fine. When assigning a value with this chr
in a label it show as "_". In the table, it shows the appropriate
character "&", and, if I use a msgBox() it will also show the "&"
chr. The only time this appears to be a problem is when I attempt to
set the value of a label to a field value that contains the "&" chr.
How do I force the "&" to show in a label?

Because the ampersand is used to mark the hot key of a label caption, if
you really want to uncorporate that character in the displayed caption
you have to double it up. For example, to get "Smith & Wesson", you
have to set the caption to "Smith && Wesson".
 
R

Rick Brandt

bernadou said:
Storing and using special Chrs?

I'm attempting to use "&" in the value of a bound text field. It saves to
the table just fine. When assigning a value with this chr in a label it show
as "_". In the table, it shows the appropriate character "&", and, if I use
a msgBox() it will also show the "&" chr. The only time this appears to be a
problem is when I attempt to set the value of a label to a field value that
contains the "&" chr. How do I force the "&" to show in a label?

Double it up (use && where you want to see &)
 
G

Guest

Thanks to all. That was helpful. The problem is that I need the field value
to contain a single "&" and the label to show that. So, if anyone else out
there is having a similar issue, I'll post my solution...

lblName.Caption = replace(Me!fldName.Value, "&", "&&")

Hope this helps someone out!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Auto Fill a Textbox in Form 3
DLookUp Format 4
dlookup with multiple criteria 7
"Sheet Total" #Error 1
Calling form from combo box 2
Insert Manual Page Breaks 7
Dynamic IF.... 1
Switchboard Problem 2

Top