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!

Displaying Field Value of Combo Box on Enter

Status
Not open for further replies.

wrightlefty

Technical User
Feb 19, 2004
17
0
0
US
I have a combo box where I can type in a part number. After typing in the number, I click on the pull down bar to view various information relating to the part number. I would like to be able to type in the number and hit 'Enter' and have the drop down appear with the information. I think I need VB coding with the 'On Enter' option, but I'm not sure. Please help.
 

Well, you can do:

Me.MyControl.SetFocus
Me.MyControl.DropDown

But after hitting ENTER isn't really a good event to try and do this from. You'd probably have to sacrifice having a normal tab-order and manipulate the right events that would get you back into the control just so you can re-open the list.

A more common way to show additional fields from the selected record is to add unbound fields to your form and then reference those dropdown fields.

Me.cboMyComboBox <-- your dropdown

For each added field just reference the dropdown column number. So if you added (4) fields, the control sources would be:

=[cboMyComboBox].column(1)
=[cboMyComboBox].column(2)
=[cboMyComboBox].column(3)
=[cboMyComboBox].column(4)

And after hitting ENTER you'll now see the related fields. Just edit the column numbers to match what you want to see. Also don't forget that column(0) is your first field.

HTH,

Mike

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top