DropDown Listbox..

  • Thread starter Thread starter Ward Horsfall
  • Start date Start date
W

Ward Horsfall

Hi,

Ok here is a tricky one :)

I am trying to work out how to create a drop-down listbox. Like a Combo Box
where you can only select
a item from the list but cannot type in the field. I have seen this in other
Windows software - how is
this possible in Access 2003. I can only do a simple ListBox or ComboBox -
what am I missing?

Thanks,

Ward.
 
There's only the one type of ComboBox (and one type of ListBox) in Access.

If your concern is that they might type something that's not in the list,
set the control's LimitToList property to True. There's also a NotInList
event that you can do something with the value they typed in, and either
decide either to use it or raise an error.
 
How hard do you want to enforce this? You can set the combo box's AutoExpand
and Limit To List properties to Yes to do this. The user can still type
whatever they want in the box, but they can't use it, they'll be told that
they have to make a selection that is in the list.

To enforce no typing, just using the mouse and the drop down list, you could
place the following code in the combo box's KeyDown event.

KeyCode = 0
 
Back
Top