If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
How to Lock or Do not Edit Combo Box
Is it possible to have a combo box where user can select what is in the
combo box but the user can not edit what is in the combo box? I tried the 3 properties listed but allow edits = No -- Locks the list whereas you can not choose the items in the combo list. allow deletions = No -- Still allows user to edit what is in the combo box allow additions = No -- Still allows user to edit what is in the combo box. Thanks cclark |
#2
|
|||
|
|||
How to Lock or Do not Edit Combo Box
cclark wrote:
Is it possible to have a combo box where user can select what is in the combo box but the user can not edit what is in the combo box? I tried the 3 properties listed but allow edits = No -- Locks the list whereas you can not choose the items in the combo list. allow deletions = No -- Still allows user to edit what is in the combo box allow additions = No -- Still allows user to edit what is in the combo box. If what you mean is can you force them to choose from the list and not manually enter something that is not shown in the list then the property you are looking for is LimitToList. Set that to true. Otherwise you will have to clarify because "editing what is in the ComboBox" can be interpreted more than one way. -- Rick Brandt, Microsoft Access MVP Email (as appropriate) to... RBrandt at Hunter dot com |
#3
|
|||
|
|||
How to Lock or Do not Edit Combo Box
cclark,
Not sure if I understand but... Sounds like you need to lock the combo (ex. name cboMyCombo) after a value has been selected. Set the combo Enabled property to Yes in design mode.. Use this code on the AfterUpdate event of cboMyCombo... cboMyCombo.Enabled = IsNull(cboMyCombo) cboMyCombo.Locked = Not IsNull(cboMyCombo) Use this code in the OnCurrent event of the form itself... cboMyCombo.Enabled = IsNull(cboMyCombo) cboMyCombo.Locked= Not IsNull(cboMyCombo) On a new record, when cboMyCombo is null, it will be anabled for selection. After the selection, the combo will lock. As you browse from record to record, the form will lock/unlock the combo according to whether it's null or not null. But... be aware that this method allows the user one shot at the combo selection. If they select the wrong value, it's too late... the combo will lock. You might want to consider using a checkbox to to disable/lock the combo (as well as the checkbox itself), after the user has determined that cboMyCombo is correct. Just figure out what works best for you, or tailor this "concept" to suit... -- hth Al Campagna Candia Computer Consulting - Candia NH http://home.comcast.net/~cccsolutions "Find a job that you love, and you'll never work a day in your life." "cclark" wrote in message ... Is it possible to have a combo box where user can select what is in the combo box but the user can not edit what is in the combo box? I tried the 3 properties listed but allow edits = No -- Locks the list whereas you can not choose the items in the combo list. allow deletions = No -- Still allows user to edit what is in the combo box allow additions = No -- Still allows user to edit what is in the combo box. Thanks cclark |
#4
|
|||
|
|||
How to Lock or Do not Edit Combo Box
"Rick Brandt" wrote in message et... cclark wrote: Is it possible to have a combo box where user can select what is in the combo box but the user can not edit what is in the combo box? I tried the 3 properties listed but allow edits = No -- Locks the list whereas you can not choose the items in the combo list. allow deletions = No -- Still allows user to edit what is in the combo box allow additions = No -- Still allows user to edit what is in the combo box. If what you mean is can you force them to choose from the list and not manually enter something that is not shown in the list then the property you are looking for is LimitToList. Set that to true. Otherwise you will have to clarify because "editing what is in the ComboBox" can be interpreted more than one way. -- Rick Brandt, Microsoft Access MVP Email (as appropriate) to... RBrandt at Hunter dot com Thanks Rick, I currently have LimitToList set to true. Right now user receives message stating "text is not in item list". But what I really want to do is lock the combo box so that user can not add additional letters to current selections or user can not put in any other info. I would like to lock the combo box so that user can not manually enter anything into the combo box. ie. if combo box list is: A B C currently users can manually enter A1 into the combo box and receive "text is not in item list". But I would like user to not have the ability to edit the field at all. They should only be able to choose from the list and not be able to edit. Thanks, cclark |
#5
|
|||
|
|||
How to Lock or Do not Edit Combo Box
cclark wrote:
I currently have LimitToList set to true. Right now user receives message stating "text is not in item list". But what I really want to do is lock the combo box so that user can not add additional letters to current selections or user can not put in any other info. I would like to lock the combo box so that user can not manually enter anything into the combo box. ie. if combo box list is: A B C currently users can manually enter A1 into the combo box and receive "text is not in item list". But I would like user to not have the ability to edit the field at all. They should only be able to choose from the list and not be able to edit. There are no property combinations that allow for that, but you can fake it. Make your ComboBox only as wide as the DropDown "arrow" and place a TextBox beside it (Locked = True). Now there will be no place for the user to type in at all on the actual ComboBox. They can drop the list down and make a selection only. Set the ControlSource of the TextBox so it is the same as that of the ComboBox and their choice will be displayed after they make a selection. -- Rick Brandt, Microsoft Access MVP Email (as appropriate) to... RBrandt at Hunter dot com |
#6
|
|||
|
|||
How to Lock or Do not Edit Combo Box
"Rick Brandt" wrote in message . net... cclark wrote: I currently have LimitToList set to true. Right now user receives message stating "text is not in item list". But what I really want to do is lock the combo box so that user can not add additional letters to current selections or user can not put in any other info. I would like to lock the combo box so that user can not manually enter anything into the combo box. ie. if combo box list is: A B C currently users can manually enter A1 into the combo box and receive "text is not in item list". But I would like user to not have the ability to edit the field at all. They should only be able to choose from the list and not be able to edit. There are no property combinations that allow for that, but you can fake it. Make your ComboBox only as wide as the DropDown "arrow" and place a TextBox beside it (Locked = True). Now there will be no place for the user to type in at all on the actual ComboBox. They can drop the list down and make a selection only. Set the ControlSource of the TextBox so it is the same as that of the ComboBox and their choice will be displayed after they make a selection. -- Rick Brandt, Microsoft Access MVP Email (as appropriate) to... RBrandt at Hunter dot com Thanks for the advice. This option may work for me with a little modification. Currently my combo box uses Row Source Type = Value List, but the list only contains 4 choices. So, I guess if I create a table in the database with the four choices, then I will be able to use your method using ControlSource. Thanks, cclark |
#7
|
|||
|
|||
How to Lock or Do not Edit Combo Box
cclark wrote:
Thanks for the advice. This option may work for me with a little modification. Currently my combo box uses Row Source Type = Value List, but the list only contains 4 choices. So, I guess if I create a table in the database with the four choices, then I will be able to use your method using ControlSource. Try it as is. It will work. -- Rick Brandt, Microsoft Access MVP Email (as appropriate) to... RBrandt at Hunter dot com |
#8
|
|||
|
|||
How to Lock or Do not Edit Combo Box
"Rick Brandt" wrote in message . net... cclark wrote: Thanks for the advice. This option may work for me with a little modification. Currently my combo box uses Row Source Type = Value List, but the list only contains 4 choices. So, I guess if I create a table in the database with the four choices, then I will be able to use your method using ControlSource. Try it as is. It will work. -- Rick Brandt, Microsoft Access MVP Email (as appropriate) to... RBrandt at Hunter dot com Rick, Thanks. It worked to a degree. I asked how this can be done if combo box list is: A, B, C Your method works for the above data, thanks. My actual list is like: Compressors, Equipment So if I make ComboBox only as wide as the DropDown "arrow" , I won't get whole word Compressors... only Co. Thanks anyway. Sorry about not giving a real representation of data earlier. cclark |
#9
|
|||
|
|||
How to Lock or Do not Edit Combo Box
cclark wrote:
"Rick Brandt" wrote in message Rick, Thanks. It worked to a degree. I asked how this can be done if combo box list is: A, B, C Your method works for the above data, thanks. My actual list is like: Compressors, Equipment So if I make ComboBox only as wide as the DropDown "arrow" , I won't get whole word Compressors... only Co. Thanks anyway. Sorry about not giving a real representation of data earlier. You don't understand. You aren't supposed to see anything in the ComboBox when you make it only as narrow as the arrow button. That is the point of the separate TextBox bound to the same field. THAT is where you will see your selection after making it. -- Rick Brandt, Microsoft Access MVP Email (as appropriate) to... RBrandt at Hunter dot com |
#10
|
|||
|
|||
How to Lock or Do not Edit Combo Box
Rick Brandt wrote:
cclark wrote: "Rick Brandt" wrote in message Rick, Thanks. It worked to a degree. I asked how this can be done if combo box list is: A, B, C Your method works for the above data, thanks. My actual list is like: Compressors, Equipment So if I make ComboBox only as wide as the DropDown "arrow" , I won't get whole word Compressors... only Co. Thanks anyway. Sorry about not giving a real representation of data earlier. I just realized you might be talking about the width of the drop down list. By default that is the same width as the ComboBox itself, but you can use the ListWidth property to make the drop down list as wide as you like. -- Rick Brandt, Microsoft Access MVP Email (as appropriate) to... RBrandt at Hunter dot com |
|
Thread Tools | |
Display Modes | |
|
|