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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multi-Select listbox has unwanted quote characters

Status
Not open for further replies.

sirnose1

Programmer
Nov 1, 2005
133
US
I have a mulit-select listbox in which You can select more than one item which is stored in a textbox. Is there a way I can store the text without the guot marks (")? Here is the code:


Dim VarItem As Variant
Dim pillarlist As String 'string to store product type selected list
Dim lst4 As ListBox 'create object of product type listbox
Dim counter As Variant

Set lst4 = Me.lstPillars

counter = 1
For Each VarItem In lst4.ItemsSelected
If counter = 1 Then
pillarlist = """" & lst4.ItemData(VarItem) & """"
Else
pillarlist = pillarlist & ", " & """" & lst4.ItemData(VarItem) & """"
End If
counter = counter + 1
Me.Text113 = pillarlist
Next VarItem
 
???
If you don't want the quotes why inserting them ?
Replace this:
pillarlist = """" & lst4.ItemData(VarItem) & """"
with this:
pillarlist = lst4.ItemData(VarItem)
And this:
pillarlist = pillarlist & ", " & """" & lst4.ItemData(VarItem) & """"
with this:
pillarlist = pillarlist & ", " lst4.ItemData(VarItem)

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Tried that. THe first line works well. The problem lies with the second line. I kept getting a compile error: syntax error.
 
You're missing an (&) symbol.

pillarlist = pillarlist & ", " lst4.ItemData(VarItem)
should be
pillarlist = pillarlist & ", " & lst4.ItemData(VarItem)

----------------------------------------
If you are reading this, then you have read too far... :p
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top