Dropdown List

M

Martureo Bob

Sorry if this it a duplicate post --- I cannot find the original or any
responses....

Using A2K, I want to create a simple unbound dropdown list on a form giving
the user specific choices, and requiring the selection of one of the
pre-determined choices.

I set the property to only permit the user to select items on the list, but
Access still allows the user to type into the control --- and get an error
message back if the result is not in the list.

It's just that this dosn't seem very "professional." If I'm requiring a
choice from a predetermined set of values, how can I set things up so that
the only thing the user can do is highlight an entry and click it (but not
type into it the control and possibly get an error).

BTW, I don't have enough room for a listbox.

Thanks!

Bob.
 
G

Guest

Hi,
A combobox will always allow a user to type data in it.
You can set the limit to list property so they can just type values which
are in the list. Additionally you can turn of autoexpand so values do not
come up when typing. If you really want to eliminate the typing then add some
code on the keyup event of the combobox:

MsgBox("Can't type here!")
Me.YourCombo = null

HTH
Good luck
 
M

Martureo Bob

Thanks --- I already have the "limit to list" property set --- that's what's
giving the current error message. But I never thought of turning off
autoexpand and using a keyup event! That sound like something cool to try
out! Bob.
 
F

fredg

Sorry if this it a duplicate post --- I cannot find the original or any
responses....

Using A2K, I want to create a simple unbound dropdown list on a form giving
the user specific choices, and requiring the selection of one of the
pre-determined choices.

I set the property to only permit the user to select items on the list, but
Access still allows the user to type into the control --- and get an error
message back if the result is not in the list.

It's just that this dosn't seem very "professional." If I'm requiring a
choice from a predetermined set of values, how can I set things up so that
the only thing the user can do is highlight an entry and click it (but not
type into it the control and possibly get an error).

BTW, I don't have enough room for a listbox.

Thanks!

Bob.

Code the Combo Box KeyPress event:

KeyAscii = 0

You can select an item but you won't be able to enter new data nor use
AutoExpand.
 
G

Guest

I am always amazed at the weird work arounds people come up with. You can
keep Auto Expand on (users love it) and supress error messages.
Keep Limit to List set to Yes

Use the Not In List Event to supress any error messages.

All you need to do is put in one line of code:
Response = acDataErrContinue

See this site for good info:
http://www.pacificdb.com.au/MVP/Code/NIL.htm
 
M

Martureo Bob

Sorry, but I don't want the user to be able to type onto this control (or at
least I want to give that appearance).
 
M

Martureo Bob

Thanks --- I'll try this approach as well. The "keyup" approach worked, but
I'll give your solution a whack! Bob.
 
G

Guest

Then maybe you do need to use the Keypress event of the control and filter
out every possible key except the up and down arrows.
 

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

Top