Lock combo box for typing new values

Acke

Registered User.
Local time
Today, 01:02
Joined
Jul 1, 2006
Messages
158
I would like to forbid typing text to the combo box. I tried limit to list option but, even if it is set to yes, you can still type text in to the combo. How can I disable user to type text in to combo? Is it possible to stop user from entering the combo, but still allow choosing combo options?

Combo box has values that are not bound to database.

Tks!
 
Properties > Data > Locked = Yes

The question is why do you want to do this? Typing in a combobox doesn't add the data to the combobox, it only allows the AutoExpand feature to work. With AutoExpand, if you type, for instance, int it goes to the first entry starting with int, which is a great help to your users. Setting Limit to List to Yes precludes the user from adding any items to the combobox.
 
Using Properties>Data>Locked = Yes, locks the field. The options are visible, but you can't change control's value. I need to be able to choose between options.

There are only two options in the combo, so auto expand option is not important.

By typing in the combo user changes original choices. Error message is the outcome. It is possible to use "Not in list" options to control this situation, but it is simpler to disable typing into combo, or to disable user to enter in the control's field at all.
 
Not sure how to do that. Whatever I do, it is still possible to type in the control. Could you please tell me which command should I use?
 
Using Bob's idea

Code:
Private Sub YourComboBox_KeyDown(KeyCode As Integer, Shift As Integer)
  KeyCode = 0
End Sub
 
Is there also a way to retain the use of tabing, while restricting tying (using Bob's idea) in the combo boxes?
 
Is there also a way to retain the use of tabing, while restricting tying (using Bob's idea) in the combo boxes?

This allows the use of the Up Arrow, Down Arrow and Return/Enter keys, for navigation, as well as the Tab key:

Code:
Private Sub ComboBoxName_KeyDown(KeyCode As Integer, Shift As Integer)

 Select Case KeyCode

  Case vbKeyReturn, vbKeyTab, vbKeyUp, vbKeyDown
   
   KeyCode = KeyCode  'Accept these keys

  Case Else
   
   KeyCode = 0 'Block all other keys
 
 End Select

End Sub
Linq ;0)>
 
sorry for the late answer . i was reading the thread cause i am trying to find a solution . i made ros source values in the table and changed both of (Allow value list edit , show only row source values) it worked :):):):):):)
 
sorry for the late answer . i was reading the thread cause i am trying to find a solution . i made ros source values in the table and changed both of (Allow value list edit , show only row source values) it worked :):):):):):)
Hi. Welcome to AWF!
 

Users who are viewing this thread

Back
Top Bottom