Subject: populating a listbox with a field contains comma
Posted By: bjcountry Post Date: 4/16/2008 12:47:03 PM
I am populating a listbox on a form. The listbox is unbound.  I am populating it via VBA and a recordset based on an SQL statement.  It is working fine except for the fact that the field I am using contains a legal name which looks like this LastName, FirstName.  I need to have the entire value populate the listbox and right now it is simply cutting off after the LastName.

I also have it set to Debug.Print and the entire name is showing in immediate window so I know it is working properly.  How do I get around the issue with the comma?

Reply By: dartcoach Reply Date: 4/16/2008 12:52:52 PM
Does your recordset pull firstname and lastname separately from the db?  If so:
Listbox.additem !lastname & "," & !firstname

did that help?

Dartcoach

dartcoach
Reply By: bjcountry Reply Date: 4/18/2008 2:08:30 PM
Just for future reference and if anyone is experiencing the same problem... after some research I found the following solution:

I set the list box with the following statement,

Me.lstLandowner.AddItem Chr(34) & strLandowner & Chr(34)

Once I did this it worked fabulous!


Go to topic 70718

Return to index page 1