by Michael S. Kaplan, published on 2008/03/20 03:01 -04:00, original URI: http://blogs.msdn.com/b/michkap/archive/2008/03/20/8327043.aspx
From the Suggestion Box, Dawn asked:
I am stumped.
I appear to have some type of autocorrect changing ampersand signs in a report header title, even though I have switched off all autocorrect functions.
I have tried quotes around the entire title, quotes around the ampersand, spaces around the ampersand.
Your knowledge base does not contain anything on ampersands nor symbol corrections.
Well, I think this might be a Microsoft Access question....
If I am wrong then ignore the answer, unless you are Dawn, in which case you should give more detail! :-)
If you look in a form (I know the question is about a report, I'll get there in a moment!), and start typing in a label, including an ampersand, it looks fine:
and then when you get out of edit mode, it changes:
Suddenly instead of Foo & Bar, it has become Foo _Bar.
Well, the ampersand is the way that you add a keyboard accelerator, so you can type the ALT key plus the next character when the form is in browse.
In this case, the accelerator is on the space, which would be weird. But this behavior will always happen.
The workaround? Type two ampersands:
and then when you commit, you will be all set:
Now logically none of this should apply to reports, since all reports in Access <= 2003 never have live accelerators in browse mode.
So none of this should have anything to do with Dawn's problem.
That would just be dumb, right?
I won't say a word.
Even though I think Smart Quotes and AutoCorrect are smarter than this behavior. :-(
Dawn, was that it? Or are we talking about something else?
This post brought for you by &⅋﹠＆ (U+0026 U+214b U+fe60 U+ff06 U+e0026, aka AMPERSAND, TURNED AMPERSAND, SMALL AMPERSAND, FULLWIDTH AMPERSAND, and TAG AMPERSAND -- anything vaguely ampersand-ey!)
Robert MacLean on 20 Mar 2008 3:30 AM:
First time ever on your blog I knew what the answer was before the end of the post!
Robert MacLean on 20 Mar 2008 3:33 AM:
Oh, and it isn't only an Access thing. I knew the answer cause Delphi did the same. I think VB 6.0 did it too.
pcooper on 20 Mar 2008 9:41 AM:
VB 6 definitely does it, although there's a UseMnemonic property on labels which lets you turn off the behavior. (Not that one would ever think to look there if one is wondering why ampersands disappear.) I don't know if Access has something similar somewhere.
Programmerman on 20 Mar 2008 11:06 AM:
It still applies to MFC code. Not that I ever use that anymore... took me half an hour to dig up some functional MFC code to test with. Long live .net!
Michael S. Kaplan on 20 Mar 2008 11:12 AM:
I do agree it is widely used functionality, but how many of those clients have a "report title" that someone would name and assume that it would be understood, which also happened to be a bad implementation of the feature? :-)
I think Access would be the main one of these (I doubt Crystal Reports would have the same problem, though I could be mistaken on that).
josh on 20 Mar 2008 12:27 PM:
Michael S. Kaplan on 20 Mar 2008 12:46 PM:
Won't work in Access, sorry! :-)
Itamar Cohen on 24 May 2009 11:01 AM:
What about menus, how do I show an & in them?
go to newer or older post, or back to index or month or day