Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Text into a List Box 1

Status
Not open for further replies.

byurow

Programmer
Jul 7, 2002
111
US
Ok, I have an Access 2003 database with a text field that "may" contain information like 'With 3" Base'. When pulling this information into a list box, my columns get messed up because of the ". I am relatively sure that I am missing something simple, but could someone please take a look at my code and see where I am going wrong? Specifically, the following is the line of code I am having difficulty with: & "'""" & rsGiftInformation!Gift & "'"";" _

Code:
        Do While Not rsGiftInformation.EOF
        Me.LstGiftInformation.RowSource = Me.LstGiftInformation.RowSource & """" & rsGiftInformation!Outgoing_Gifts_ID & """;" _
        & """" & rsGiftInformation!Trip_ID & """;" _
        & """" & rsGiftInformation!Gift_Group & """;" _
        & "'""" & rsGiftInformation!Gift & "'"";" _
        & """" & rsGiftInformation!Gift_Cost & """;" 
         rsGiftInformation.MoveNext
    Loop

This code gives me a list box that looks something like this (the first 2 columns are hidden):

Code:
Principal Gifts   "Tiffany Globe - 3"   191.25
Principal Gifts   "Ceramic Tray         38.5
Generic Gift      "Ball Cap             12.15

How do I get rid of the leading " without Access chaning the column delimination due to the 3" in the first record? Thank you!

Brenda
 
The problem is likely the " char used to express inches. You need to change it to two double quotes. If you can't change the raw data, use Replace(dataname,""","""").
Good Luck!

Silence is golden.
Duct tape is silver.
 
Nope, I can't change the raw data. I'm not quite sure how to use the Replace function in a list box, but I will play around and if I get stuck will start a new thread. Thanks for the help!
 
Makes ya wanna strangle the DBA, doesn't it? He should know better than to allow reserved characters on the DB!

Silence is golden.
Duct tape is silver.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top