Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms / December 2007

Tip: Looking for answers? Try searching our database.

Why does it add two items?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Stapes - 18 Dec 2007 15:47 GMT
Hi

I have the following line of code:

ctrlListBox.AddItem Item:=strItem

However, where the value of strItem contains a comma, such as KOREA,
DEMOCRATIC PEOPLE'S REP, it comes out as two separate items, KOREA and
DEMOCRATIC PEOPLE'S REP.

Why is this? How can I prevent it?

Stapes
Dirk Goldgar - 18 Dec 2007 16:01 GMT
> Hi
>
[quoted text clipped - 7 lines]
>
> Why is this? How can I prevent it?

Because the list box uses the comma as a value-separator in its rowsource,
you must enclose the value to be added in quotes (single or double) when you
add it, if it contains (or may contain) a comma:

   ctrlListBox.AddItem Item:=Chr(34) & strItem & Chr(34)

Signature

Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.