How to use "&" in a label?

  • Thread starter Thread starter Guest
  • Start date Start date
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
 
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".
 
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 &)
 
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!
 
Back
Top