|
 |
access thread: Un-editable Combo Box? How?
Message #1 by "Kaufman, Michael" <Michael.Kaufman@a...> on Wed, 31 Jul 2002 15:14:08 -0400
|
|
All,
I have a ComboBox that I want to populate with a Query. This works.
However, I only want the users to be able to select from the values in the
list; I specifically do NOT want them typing in the text field of the
ComboBox. I looked through all the properties of a ComboBox, but can't seem
to figure this (seemingly simple) thing out.
I have "Limit to List" set to Yes; what else must I do? This is a pretty
common style of this control, I'm sure, as I've seen it many times in other
applications.
Thanks,
-Mike
Message #2 by "Amy Wyatt" <amyw@c...> on Wed, 31 Jul 2002 20:55:53
|
|
I am a little confused as to what is happening. In a combo box you
generally have the ability to start typing. However, with the Limit to
List property set to Yes you will not be able to save what is typed in
unless it matches a value in the combo box list.
However, you can keep them from typing into the box if you add this code
to your combo box On KeyPress event
If KeyAscii <> vbKeyTab Then
Me.ComboBoxName.Dropdown
KeyAscii=0
End If
This will drop the list down but no characters should be typed in for any
key pressed on the keyboard except Tab. Be aware that this is annoying if
the person using the form has a long list because they will have to scroll
through the list to find the correct value. It is much nicer if you have
more than 10-20 items in the combo box list to be able to type 'w' and get
to the 'w's in the list. If you remove the line KeyAscii=0 from the above
code you may like the results better, and so will any data entry people
who may use the form.
Hope this helps,
Amy
>
All,
I have a ComboBox that I want to populate with a Query. This works.
However, I only want the users to be able to select from the values in the
list; I specifically do NOT want them typing in the text field of the
ComboBox. I looked through all the properties of a ComboBox, but can't seem
to figure this (seemingly simple) thing out.
I have "Limit to List" set to Yes; what else must I do? This is a pretty
common style of this control, I'm sure, as I've seen it many times in other
applications.
Thanks,
-Mike
Message #3 by "DiBernardo, Michael" <Michael.DiBernardo@m...> on Wed, 31 Jul 2002 16:18:40 -0400
|
|
I think he's looking for behaviour akin to combo boxes in
most web browsers. I'm not going to even attempt to distinguish
the difference in plain English, just go fiddle with a web form
to see the difference. The Access combo box irritated me to no
end when I first started using it.
-----Original Message-----
From: Amy Wyatt [mailto:amyw@c...]
Sent: 2002 Jul 31 4:56 PM
To: Access
Subject: [access] Re: Un-editable Combo Box? How?
I am a little confused as to what is happening. In a combo box you
generally have the ability to start typing. However, with the Limit to
List property set to Yes you will not be able to save what is typed in
unless it matches a value in the combo box list.
However, you can keep them from typing into the box if you add this code
to your combo box On KeyPress event
If KeyAscii <> vbKeyTab Then
Me.ComboBoxName.Dropdown
KeyAscii=0
End If
This will drop the list down but no characters should be typed in for any
key pressed on the keyboard except Tab. Be aware that this is annoying if
the person using the form has a long list because they will have to scroll
through the list to find the correct value. It is much nicer if you have
more than 10-20 items in the combo box list to be able to type 'w' and get
to the 'w's in the list. If you remove the line KeyAscii=0 from the above
code you may like the results better, and so will any data entry people
who may use the form.
Hope this helps,
Amy
>
All,
I have a ComboBox that I want to populate with a Query. This works.
However, I only want the users to be able to select from the values in the
list; I specifically do NOT want them typing in the text field of the
ComboBox. I looked through all the properties of a ComboBox, but can't seem
to figure this (seemingly simple) thing out.
I have "Limit to List" set to Yes; what else must I do? This is a pretty
common style of this control, I'm sure, as I've seen it many times in other
applications.
Thanks,
-Mike
Message #4 by "Kaufman, Michael" <Michael.Kaufman@a...> on Wed, 31 Jul 2002 17:20:45 -0400
|
|
Amy,
I understand what you're saying about typing and auto-scrolling to the first
match. However, the result set of this particular query is guaranteed to be
(relatively) small: a range of dates for the past 2-4 weeks. I do not want
the user typing in a date that is not in the database, I want to force him
to select one of the "pre-approved" dates in the drop-down list. Your code
is an interesting workaround. I may very well end up using it. However, I
am still curious why I can't get the behaviour that I want.
Not just on web pages, but in many applications I've seen this. I remember
in the "Bad Old Days" of Win95 and previous, there were actually two
controls: a "drop-down box" and "combo box". They both appeared the same:
a text-field-like box with a down-arrow button rigth next to it. But the
"drop-down box" functionality did not allow any typing in the
text-field-like area at all: the user must select one of the items in the
drop-down list. The combo-box, however, did allow user typing.
I understand that these are two very similar items, so eventually being
combined into the same control makes sense. I'm just trying to affect the
former effect, rather than take the default of the latter.
-Mike
> -----Original Message-----
> From: Amy Wyatt [mailto:amyw@c...]
> Sent: Wednesday, July 31, 2002 4:56 PM
> To: Access
> Subject: [access] Re: Un-editable Combo Box? How?
>
>
> I am a little confused as to what is happening. In a combo box you
> generally have the ability to start typing. However, with the
> Limit to
> List property set to Yes you will not be able to save what is
> typed in
> unless it matches a value in the combo box list.
>
> However, you can keep them from typing into the box if you
> add this code
> to your combo box On KeyPress event
> If KeyAscii <> vbKeyTab Then
> Me.ComboBoxName.Dropdown
> KeyAscii=0
> End If
>
> This will drop the list down but no characters should be
> typed in for any
> key pressed on the keyboard except Tab. Be aware that this is
> annoying if
> the person using the form has a long list because they will
> have to scroll
> through the list to find the correct value. It is much nicer
> if you have
> more than 10-20 items in the combo box list to be able to
> type 'w' and get
> to the 'w's in the list. If you remove the line KeyAscii=0
> from the above
> code you may like the results better, and so will any data
> entry people
> who may use the form.
>
>
> Hope this helps,
>
> Amy
>
> >
> All,
>
> I have a ComboBox that I want to populate with a Query. This
> works. However, I only want the users to be able to select
> from the values in the list; I specifically do NOT want them
> typing in the text field of the ComboBox. I looked through
> all the properties of a ComboBox, but can't seem to figure
> this (seemingly simple) thing out.
> I have "Limit to List" set to Yes; what else must I do? This
> is a pretty common style of this control, I'm sure, as I've
> seen it many times in other applications.
>
> Thanks,
> -Mike
>
|
|
 |