I would like to know what property stops the drop down from being edited at all. I have only in list set to yes but the user can still type in the drop down. I don't want them to be able to do that.
Sorry guys for the weak explanation.
I have about 6 things in the list. I want the drop down to acted like a web drop down. Then click the drop down and select and they aren't able to type anything in. I can't use a list box it has to be a drop down.
It's often worth excluding keys that users might legitimately be pressing in the event... (e.g. the Tab key to navigate to the next control ;-)
e.g.
If KeyCode <> 9 Then
or a few such as Enter, Escape etc.
FWIW you can also cancel the event instead of reassigning the KeyCode.
Code:
Select Case KeyCode
Case 9, 13, 27 'Allow these key events to proceed
Case Else
DoCmd.CancelEvent
End Select
Yes it does, and Leigh has a good point. If you want your users to only use the mouse to make selections my code is fine. Otherwise you need to allow certain keys as Leigh suggested. You might also allow the Up and Down Arrows:
Code:
Select Case KeyCode
Case 9, 13, 27, vbKeyUp, vbKeyDown 'Allow these key events to proceed
Case Else
DoCmd.CancelEvent
End Select