dbTalk Databases Forums  

Ampersand in string behaves different on form caption and reportfooter

comp.databases.ms-access comp.databases.ms-access


Discuss Ampersand in string behaves different on form caption and reportfooter in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Arno R
 
Posts: n/a

Default Ampersand in string behaves different on form caption and reportfooter - 03-21-2011 , 08:24 AM






Hi all.
I have a client where there is an ampersand in the company-name.
Like AT&T
I am using a global string gstrRegorg to display the Company-name on
form-captions and in report-footers.

The name 'AT&T' displays perfect on form captions BUT
With the report footer I Need 'AT&&T' to display 'AT&T'

Is there a way around this?

I tried using Chr$(38) instead of & but that gives the same behavior

Arno R

Reply With Quote
  #2  
Old   
imb
 
Posts: n/a

Default Re: Ampersand in string behaves different on form caption and report footer - 03-21-2011 , 09:27 AM






On Mar 21, 3:24*pm, Arno R <arracomn_o_s_p_... (AT) planet (DOT) nl> wrote:
Quote:
Hi all.
I have a client where there is an ampersand in the company-name.
Like AT&T
I am using a global string gstrRegorg to display the Company-name on
form-captions and in report-footers.

The name 'AT&T' displays perfect on form captions BUT
With the report footer I Need 'AT&&T' to display 'AT&T'

Is there a way around this?

I tried using Chr$(38) instead of & but that gives the same behavior

Arno R
Hi Arno,

In the report footer you could use a function that doubles the
ampersands (replace & by &&) of the argument, in this case the global
Company name.

Imb.

Reply With Quote
  #3  
Old   
Marshall Barton
 
Posts: n/a

Default Re: Ampersand in string behaves different on form caption and report footer - 03-21-2011 , 09:38 AM



Arno R wrote:
Quote:
I have a client where there is an ampersand in the company-name.
Like AT&T
I am using a global string gstrRegorg to display the Company-name on
form-captions and in report-footers.

The name 'AT&T' displays perfect on form captions BUT
With the report footer I Need 'AT&&T' to display 'AT&T'

Is there a way around this?

I tried using Chr$(38) instead of & but that gives the same behavior

Where is the AT&&T coming from?
What kind of control are you trying to display the AT&T in?

If you are typing it into a label's Caption property it
should work as you want.

If you are entering it into a bound control then don't add
the extra &

If you are use VBA code to set a label's Caption from a
value that has AT&T, then use the Replace function to add
the extra &
Me.Label0.Caption = Replace(Me.companyname, "&", "&&")
If you are using this VBA code to set a text box, then do
not use the replace function.

--
Marsh

Reply With Quote
  #4  
Old   
Phil
 
Posts: n/a

Default Re: Ampersand in string behaves different on form caption and report footer - 03-21-2011 , 11:14 AM



On 21/03/2011 15:38:44, Marshall Barton wrote:
Quote:
Arno R wrote:
I have a client where there is an ampersand in the company-name.
Like AT&T
I am using a global string gstrRegorg to display the Company-name on
form-captions and in report-footers.

The name 'AT&T' displays perfect on form captions BUT
With the report footer I Need 'AT&&T' to display 'AT&T'

Is there a way around this?

I tried using Chr$(38) instead of & but that gives the same behavior


Where is the AT&&T coming from?
What kind of control are you trying to display the AT&T in?

If you are typing it into a label's Caption property it
should work as you want.

If you are entering it into a bound control then don't add
the extra &

If you are use VBA code to set a label's Caption from a
value that has AT&T, then use the Replace function to add
the extra &
Me.Label0.Caption = Replace(Me.companyname, "&", "&&")
If you are using this VBA code to set a text box, then do
not use the replace function.

--
Marsh

Might be worth using a textbox instead of a label in the footer
Phil

Reply With Quote
  #5  
Old   
Arno R
 
Posts: n/a

Default Re: Ampersand in string behaves different on form caption and reportfooter - 03-21-2011 , 12:11 PM



Op 21-03-2011 18:14, Phil schreef:
Quote:
On 21/03/2011 15:38:44, Marshall Barton wrote:
Arno R wrote:
I have a client where there is an ampersand in the company-name.
Like AT&T
I am using a global string gstrRegorg to display the Company-name on
form-captions and in report-footers.

The name 'AT&T' displays perfect on form captions BUT
With the report footer I Need 'AT&&T' to display 'AT&T'

Is there a way around this?

I tried using Chr$(38) instead of& but that gives the same behavior


Where is the AT&&T coming from?
What kind of control are you trying to display the AT&T in?

If you are typing it into a label's Caption property it
should work as you want.

If you are entering it into a bound control then don't add
the extra&

If you are use VBA code to set a label's Caption from a
value that has AT&T, then use the Replace function to add
the extra&
Me.Label0.Caption = Replace(Me.companyname, "&","&&")
If you are using this VBA code to set a text box, then do
not use the replace function.

--
Marsh


Might be worth using a textbox instead of a label in the footer
Phil
Would be a good idea IF I had known this issue before...
I have 100+ reports in that application.

I guess my best bet is to use double && and to change the Form-caption
to one & with the replace function..

Thanks
Arno R

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.