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 / Modules / DAO / VBA / February 2005

Tip: Looking for answers? Try searching our database.

Commas in list box items

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Andy Dorph - 15 Feb 2005 14:11 GMT
I am populating a list box from values in a table.  One of the table values,
a text field, may or may not contain commas (,).  When a comma is
encountered, the list box acts as if it is a semi-colon (;), treating the
comma as a delimiter.   Is there a workaround?

Thanks in advance
David C. Holley - 15 Feb 2005 16:43 GMT
How are you populting the list box? Are you populating it from a
Table/Query? Commas in a field value are possible.

David H

> I am populating a list box from values in a table.  One of the table values,
> a text field, may or may not contain commas (,).  When a comma is
> encountered, the list box acts as if it is a semi-colon (;), treating the
> comma as a delimiter.   Is there a workaround?
>
> Thanks in advance
Andy Dorph - 15 Feb 2005 17:45 GMT
I am using a table, running a SELECT query and populating it from the
recordset using the AddItem method.

> How are you populting the list box? Are you populating it from a
> Table/Query? Commas in a field value are possible.
[quoted text clipped - 7 lines]
> >
> > Thanks in advance
Alex Dybenko - 15 Feb 2005 18:04 GMT
why not to bind query directly to combobox? set rowsource type to
Table/Query and row source to your query

Signature

Alex Dybenko (MVP)
http://Alex.Dybenko.com
http://www.PointLtd.com

>I am using a table, running a SELECT query and populating it from the
> recordset using the AddItem method.
[quoted text clipped - 12 lines]
>> >
>> > Thanks in advance
Andy Dorph - 15 Feb 2005 19:15 GMT
Alex:

I need to customize the list box.  The only problem I have is when the text
contains a comma.  It is then treated as a delimiter.  All I am looking for
is an easy workaround, if possible.  I have to use List Values as my
rowsource type to be able to add the custom selection(s), so binding it to a
table/query is not feasible.

Spaseeba.

> why not to bind query directly to combobox? set rowsource type to
> Table/Query and row source to your query
[quoted text clipped - 15 lines]
> >> >
> >> > Thanks in advance
David C. Holley - 15 Feb 2005 21:24 GMT
Could you please elaborate on how you need to customize the list box?
More likely than not the customization is possible at the query level.

David H

> Alex:
>
[quoted text clipped - 25 lines]
>>>>>
>>>>>Thanks in advance
David C. Holley - 15 Feb 2005 19:06 GMT
If there's no special logic that you're exerting on the field values
using VBA, change the RowSourceType to Table/Query and set the RowSource
to the Query.

David H

> I am using a table, running a SELECT query and populating it from the
> recordset using the AddItem method.
[quoted text clipped - 10 lines]
>>>
>>>Thanks in advance
John Nurick - 15 Feb 2005 22:05 GMT
Hi Andy,

Have you tried enclosing the values in quotes?

    "first";"second,comma";"third"

>I am populating a list box from values in a table.  One of the table values,
>a text field, may or may not contain commas (,).  When a comma is
>encountered, the list box acts as if it is a semi-colon (;), treating the
>comma as a delimiter.   Is there a workaround?
>
>Thanks in advance

--
John Nurick [Microsoft Access MVP]

Please respond in the newgroup and not by email.
Andy Dorph - 16 Feb 2005 11:03 GMT
John:

Thanks for your suggestion.  I had read that suggestion under another thread
and had tried it with no success.

> Hi Andy,
>
[quoted text clipped - 13 lines]
>
> Please respond in the newgroup and not by email.
John Nurick - 16 Feb 2005 21:15 GMT
Curious. It works when I try it (Access 2003, Win XP, regional settings
English UK). This is pasted from one of my comboboxes' RowSource
property:
 "test";"with; colon";"with, comma";"without";unquoted
and it displays as
    test
    with; colon
    with, commma
    without
    unquoted

Alternatives: as David H suggests, write a query to customise the list
contents; or write code that strips out the commas. Possibly you could
substitute "‚" the "single low-9 quotation mark", which is at 0x082 in
western European character sets, or U+201A in Unicode.

>John:
>
[quoted text clipped - 18 lines]
>>
>> Please respond in the newgroup and not by email.

--
John Nurick [Microsoft Access MVP]

Please respond in the newgroup and not by email.
David C. Holley - 17 Feb 2005 09:47 GMT
Could you please elaborate on how you need to customize the list box?
More likely than not the customization is possible at the query level.
The technique that you are currently using obviously isn't working. If
you share with us the big picture, we should be able to come up with a
solution for you.

David H

> John:
>
[quoted text clipped - 18 lines]
>>
>>Please respond in the newgroup and not by email.
 
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.