Solved

& Character

Posted on 2003-12-02
4
181 Views
Last Modified: 2010-05-01
Simple question, but my brains gone numb and I cant think of the code I need!

Im getting data from a database that has a & in it. E.g. One & Two

However when I display this in a label it shows as One _ Two,

Any help much appreciated.
0
Comment
Question by:Terry Rogers
  • 2
4 Comments
 
LVL 53

Expert Comment

by:Dhaest
Comment Utility
I guess you'll have to replace every & character by 2 &-characters. Give it a try and let me know what you get then....
0
 
LVL 6

Accepted Solution

by:
rvooijs earned 100 total points
Comment Utility
Hi,

If you want this text to be displayed in a label, you will have to replace the & with &&.

something like:
    myLabel.caption = replace(myText, "&", "&&").

One other option would be to use a textbox in stead of a label. Make the background transparent, disable and lock it, and it behaves like a label.

Any good ?

Robert
0
 
LVL 53

Expert Comment

by:Dhaest
Comment Utility
Didn't I say exactly the same thing ?
0
 

Expert Comment

by:josebirla
Comment Utility
make a condition just before in order to find out the precense of & in the field and use replace function


eg.  if instr(1, rs(fieldName).value, '&') then
              str=replace(rs(fieldName).value, "&", "&&")
      else
             str= rs(fieldName).value
      end if
     label1.caption=str


   
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now