p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   Access (http://p2p.wrox.com/forumdisplay.php?f=18)
-   -   populating a listbox with a field contains comma (http://p2p.wrox.com/showthread.php?t=67455)

bjcountry April 16th, 2008 12:47 PM

populating a listbox with a field contains comma
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?

dartcoach April 16th, 2008 12:52 PM

Does your recordset pull firstname and lastname separately from the db? If so:
Listbox.additem !lastname & "," & !firstname

did that help?



bjcountry April 18th, 2008 02:08 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!

acetek February 17th, 2016 05:07 PM

Thank you so much for this! Saved me and may have won me a day off! [:)][}:)]

All times are GMT -4. The time now is 04:30 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.