Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
Password Reminder
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old April 16th, 2008, 12:47 PM
Registered User
Join Date: Mar 2008
Location: , , .
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?

Reply With Quote
  #2 (permalink)  
Old April 16th, 2008, 12:52 PM
Friend of Wrox
Join Date: Jan 2005
Location: Kansas City, Missouri, USA.
Posts: 471
Thanks: 0
Thanked 1 Time in 1 Post

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

did that help?


Reply With Quote
  #3 (permalink)  
Old April 18th, 2008, 02:08 PM
Registered User
Join Date: Mar 2008
Location: , , .
Posts: 7
Thanks: 0
Thanked 1 Time in 1 Post

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!

Reply With Quote
The Following User Says Thank You to bjcountry For This Useful Post:
acetek (February 17th, 2016)
  #4 (permalink)  
Old February 17th, 2016, 05:07 PM
Registered User
Points: 3, Level: 1
Points: 3, Level: 1 Points: 3, Level: 1 Points: 3, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Feb 2016
Posts: 1
Thanks: 1
Thanked 0 Times in 0 Posts

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

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are 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

All times are GMT -4. The time now is 10:54 AM.

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