Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
|
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 16th, 2008, 12:47 PM
Registered User
 
Join Date: Mar 2008
Posts: 7
Thanks: 0
Thanked 1 Time in 1 Post
Default 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?

 
Old April 16th, 2008, 12:52 PM
Friend of Wrox
 
Join Date: Jan 2005
Posts: 471
Thanks: 0
Thanked 1 Time in 1 Post
Default

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

did that help?

Dartcoach

dartcoach
 
Old April 18th, 2008, 02:08 PM
Registered User
 
Join Date: Mar 2008
Posts: 7
Thanks: 0
Thanked 1 Time in 1 Post
Default

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!

The Following User Says Thank You to bjcountry For This Useful Post:
acetek (February 17th, 2016)
 
Old February 17th, 2016, 05:07 PM
Registered User
 
Join Date: Feb 2016
Posts: 1
Thanks: 1
Thanked 0 Times in 0 Posts
Smile THANK YOU!

Thank you so much for this! Saved me and may have won me a day off!





Similar Threads
Thread Thread Starter Forum Replies Last Post
Inserting comma in the field issaq SQL Language 0 February 20th, 2008 08:41 AM
Populating a listbox dlamarche Excel VBA 3 November 1st, 2007 02:13 PM
CSV File to Array Problems with Comma in Field MSchoaf Classic ASP Basics 1 July 19th, 2006 05:58 PM
populating data into listbox adn datagrid madhava_ram Flash (all versions) 1 February 25th, 2005 11:46 PM
Populating field Popper Javascript How-To 10 September 23rd, 2004 06:06 PM





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