Asterisk In Combo Box

D

Derek Hart

I have a list of items that are in a combo box, some of which begin with an
asterisk. The combo box does not work as well with items that begin with an
asterisk. For example, when I paste in an item it often says the item is not
in the list; this is when pasting an item that begins with an asterisk and
Limit To List is set to true. But if I set Limit To List to false, it allows
it to paste in, but it is a bummer that I cannot use Limit To List in this
instance. Also, when I choose an item with an asterisk, and then later come
back to the combo box and drop it down, usually Access places me in the list
at that item, but it does not when using an asterisk first item; it just
looks like the item is not chosen. This is subtle behavior but very
specific to items that begin with an asterisk. Any workarounds?

Derek
 
A

Allen Browne

The asterisk is used as the wildcard in Access queries.
It will give you problems matching, especially with the Like operator.

There may be workarounds, such as using the ALike operator with % in some
contexts and versions of Access, or by by adding square brackets around the
value at runtime when you use it in an expression with the Like operator,
e.g.:
Replace([MyField], "*", "[*]")

But essentially, the asterisk is an impossibly bad choice of character in a
key field. (I assume it is in the key field, since you are able to use
LimitToList.)
 
D

Derek Hart

But I am just choosing an item in the list and it will not find where it is
in the list the next time I drop it down. Have you seen this happen, and is
there a way around it?


Allen Browne said:
The asterisk is used as the wildcard in Access queries.
It will give you problems matching, especially with the Like operator.

There may be workarounds, such as using the ALike operator with % in some
contexts and versions of Access, or by by adding square brackets around
the value at runtime when you use it in an expression with the Like
operator, e.g.:
Replace([MyField], "*", "[*]")

But essentially, the asterisk is an impossibly bad choice of character in
a key field. (I assume it is in the key field, since you are able to use
LimitToList.)

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

Derek Hart said:
I have a list of items that are in a combo box, some of which begin with
an asterisk. The combo box does not work as well with items that begin
with an asterisk. For example, when I paste in an item it often says the
item is not in the list; this is when pasting an item that begins with an
asterisk and Limit To List is set to true. But if I set Limit To List to
false, it allows it to paste in, but it is a bummer that I cannot use
Limit To List in this instance. Also, when I choose an item with an
asterisk, and then later come back to the combo box and drop it down,
usually Access places me in the list at that item, but it does not when
using an asterisk first item; it just looks like the item is not chosen.
This is subtle behavior but very specific to items that begin with an
asterisk. Any workarounds?

Derek
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top