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

Moving data with commas in it

Status
Not open for further replies.

randaj

MIS
Jan 7, 2003
34
US
I am building a reports form that needs to move data from one list box to another for reporting. The problem is is that it is a chemical database and some of the compounds have commas in there names. For example, 1,3 diaminopropane.
When I try to move the data, the comma separates the name into 2 rows on the secondlist. What can I do?
 
I have a sample of moving data from 1 listbox to another and I have just tried this without having the problem you report.
I can only suggest that you ensure that the column count is set to 1

Frank J Hill
FHS Services Ltd.
frank@fhsservices.co.uk
 
Column Count is set to 1. This is the code I used:
Private Sub cmdAdd1_Click()
Dim itm As Variant
For itm = 0 To lstCompound.ListCount - 1
If lstCompound.Selected(itm) Then
lstCompoundAdd.AddItem lstCompound.ItemData(itm)
End If
Next itm
End Sub

Do this look right?
 
3 Things:
- are your compounds not identified with an ID as opposed to their Name. If you move them by ID the problem will go away because it is dealing with an integer.

- Why use itm as a Variant you want it to be text so why not string?

- The code above looks to be working with a single listbox (lstCompound) and I cannot see where it is tranferring the selection to another listbox!

Frank J Hill
FHS Services Ltd.
frank@fhsservices.co.uk
 
First, I appreciate your help.
1. Using the ID might be an option, but it will be my last.
2. When I use string I get an error. It stops on the For statement.
3. lstCompoundAdd is the second listbox.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top