469,268 Members | 920 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,268 developers. It's quick & easy.

How can I prevent any input to a Combo Box without "Locking" it?

Hello all,

I have an issue that I just realized that I can seem to figure out on my own...

I have a few combo boxes on a form that are all linked to different tables. Each combo box has the following settings:

Limit To List - Yes
Allow Value List Edits - No

However simply placing the cursor in the combobox allows you to click and edit whatever is chosen...is there a way to "Lock" the combo box so that this is not possible but with still allowing the user to make a selection?

Simply switching the "Locked" option for the box to "Yes" prevents the user from making a selection and I can't see anywhere else where this option could be changed.

Thanks in advance, I appreciate all the help!
Dec 1 '10 #1
10 23233
slenish
283 100+
I created a sample database for you to help you on this matter. The one thing you have to ask yourself is do you want the person using it to only be allowed to select something once?

I assumed no and created a button next to the combo box to reset the box. You can not delete or change the information once you select it from the drop down but if you wanted to go back and change something you just press the undo button and then you can make a new selection.

hope this helps :D
Attached Files
File Type: zip LockingCombo.zip (9.9 KB, 1100 views)
Dec 2 '10 #2
If you set limit to list then if you type in a different value it should show an errorbox not in list and return you to the combobox?
Dec 2 '10 #3
@slenish - thanks for providing the sample, though I'm not so much worried about the user changing the selection as I am about the user being able to place the cursor in the combobox field and type away

@malcolmk - having the Limit To List does prompt the error message if the user (for whatever reason) makes changes, however I was hoping to avoid that process altogether...
Dec 2 '10 #4
can you not use a listbox instead?
Dec 3 '10 #5
I could, but was hoping to use a combobox because it works better for my layout. If there isn't a simple fix I might have to switch it though...
Dec 3 '10 #6
slenish
283 100+
Sorry Tim,
I dont know of any other way you can select records and keep a combo box locked other than the example I made. I would agree with malcolmk and say maybe using a listbox would be a better choice.
Dec 3 '10 #7
OldBirdman
675 512MB
M$ defines a ComboBox as a combination of a ListBox and a TextBox. But in this case, it doesn't quite measure up to the definition. You could create your own ComboBox (or at least a look-alike).
It was suggested that you use a ListBox, and you rejected that for cosmetic reasons. Nothing wrong with that. But you imply that a ListBox will work. If so, I have a solution.
I created an apparent ComboBox from a ListBox, a TextBox, and a Command Button. See the Demo Attached. The one other control is to show the value of the bound column of the ListBox, which is hidden. This shows that the ListBox could be bound to a Table/Query in the same manner as any ComboBox.
Attached Files
File Type: zip ComboList.zip (17.7 KB, 1073 views)
Dec 3 '10 #8
slenish
283 100+
Wow that is a nice example OldBirdman. Never thought of doing it that way.

Have to save this post in case I need something like that at a later time.
Dec 4 '10 #9
OldBirdman
675 512MB
Thank you. I use this (with variations) whenever I don't want to give up the space for a ListBox, but want exactly one of a limited list, such as day-of-week. It does give up allowing auto-complete, so "Friday" has to be selected, not typed as an "F".
Dec 4 '10 #10
I actually ran across this yesterday and figured out that you can keep people from typing in the combobox if you want 2 but still allow them to select what is needed

Private Sub MPAARating_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode <> 9 Then
KeyCode = 0
End If
End Sub
Dec 5 '10 #11

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

1 post views Thread by me | last post: by
94 posts views Thread by Samuel R. Neff | last post: by
26 posts views Thread by Don Calloway | last post: by
350 posts views Thread by Lloyd Bonafide | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.