473,396 Members | 2,029 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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 25084
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, 1197 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, 1143 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

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

Similar topics

9
by: deko | last post by:
I have a page that I don't want anyone to be able to link directly to. The page should only be accessed from gatepage.php. I tried this code, but keep getting errors - "header info already sent",...
77
by: Jon Skeet [C# MVP] | last post by:
Please excuse the cross-post - I'm pretty sure I've had interest in the article on all the groups this is posted to. I've finally managed to finish my article on multi-threading - at least for...
1
by: me | last post by:
I'm building a multi user app where many admins will be making calls to people in one table. I want to keep things simple and find a way to prevent 2 or more admins from working on the same record...
2
by: titan nyquist | last post by:
I thought I need something like this, but it turns out I don't. I'm still interested if this can be done: Can you do a multi-thread "lock", that locks out everything else, all other threads,...
6
by: Anders J | last post by:
Hi We have some code that runs in a EventReceiver ItemAdded handler. The code must be thread-safe since it is iterating a List to find the max number of a column and assigns it + 1 to the Item...
94
by: Samuel R. Neff | last post by:
When is it appropriate to use "volatile" keyword? The docs simply state: " The volatile modifier is usually used for a field that is accessed by multiple threads without using the lock...
26
by: Don Calloway | last post by:
I have created a <filename>.db1 (where <filenameis the name given to the database) Access database that is being used in multi-user mode. When the <filename>.db1 file is opened by a user, the...
350
by: Lloyd Bonafide | last post by:
I followed a link to James Kanze's web site in another thread and was surprised to read this comment by a link to a GC: "I can't imagine writing C++ without it" How many of you c.l.c++'ers use...
6
by: Curious | last post by:
I have an arraylist used in three separate methods. In method #1 (event method), some items are removed from the arraylist if certain conditions are met; In method #2 (event method),...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.