Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Combo Box - Automatic Dropdown

Status
Not open for further replies.

ottograham

Technical User
Mar 30, 2001
109
0
0
US
Can anyone show me the code to add to a combobox to automatically drop down the list of records as soon as one clicks into the field?

Thank you.
 
the best way is to use the wizard. Make sure the little wand on the top right icon of the 'toolbox' is clicked and when you move a combo box to the form the wiz leads you thru it. Want a sample. Let me know by email.

rollie@bwsys.net
 
Dear Rolliee:

Thanks for the quick reply. I just used the wizard and it didn't do what I wanted. Let me be more specific.

The combo box is populated with two fields from table Account: Work Phone and Trade Name.

When the user clicks into the combo box, I want it to automatically drop down and show the list of values (just like it would if you clicked the down arrow).

I didn't see any place in the wizard that addressed how to do this.

Please show me how you do it.

Thanks
 
Put the following code in the dropdowns On Enter event:

Me.NameOfDropdownfield.Dropdown

If you want to make it real slick and have the cursor automatically move to the next field after a dropdown value is selected put the following code in the dropdowns After Update event:

Me!NameOfNextField.SetFocus
 
humbleprogrammer,
The problem with automatically jumping to the next field is that you don't know that is what they want to do. If they type in the data rather than selecting it from the dropdown list, and then click into a different field, the After Update event will fire, and the code would send them to the next field. I've done this and had complaints from angry users about it.
 
The After Update doesn't fire until you select something from the drop down. Clicking into the dropdown doesn't move the cursor to the next field. The cursor doesn't move until something is selected from the dropdown. I have this in one of my applications and it works.
 
After Update also fires if you manually enter the data in the drop down, and then click into an entirely separate field. Try it without ever touching the dropdown. Just type your data, and then click into the previous field rather than the next field.
 
Yes, this is true but wouldn't you only really want to use this if you want the cursor to always go to the next field? If users need to click previous fields, then there is no need or point for this option. It eliminates 1 less click and makes data entry faster, unless like you state, your users need to click back and forth.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top