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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Combo box question

Status
Not open for further replies.

lmcc007

Technical User
May 7, 2009
164
US
Is there a way to choose a number but display the text? That is, we have over a thousand records to enter; therefore, it would be easier for them to choose 1, 2, 3, 4 and so on instead of having to type the first few letters from a list, hit the down arrow and choose the correct one. The lookup table is as follows:

tlkpEventTypes
EventTypeID...........EventType
1..........................Authorization -- general
2..........................Authorization -- credit and criminal background check
3..........................Authorization -- medical
4..........................Authorization -- tax

and so on.
 
Use a ComboBox showing the 2 columns of the lookup table.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Yeah, I did that--not what I wanted. I am going to try to do a text box equaled to the combo box and so on to get it to work. Thanks!
 
Why didn't you want that? You could change the SQL of the Row Source to something like
Code:
Select EventTypeID, EventTypeID & " " & EventType
FROM tlkpEventTypes
ORDER BY EventTypeID;
Set the column widths to 0,1.

Duane
Hook'D on Access
MS Access MVP
 
Because I want the text to show even though they are actually choosing # 1, 2, 3, and so on.
 
Assuming your list of events is not too many, you may want to do something like this.

Create a listbox one row in height. Then determine the approximate height of a listbox to show all your choices.
As you enter the one row listbox it will expand to show all of your choices. You can either click on a choice and leave. At that point the list goes back down to a single row. Or double click the list and collapse it back.

I think this is faster then any suggestion. Enter, click. This is really quick if you tab in, down arrow, hit return.

Code:
Public lngHeight As Long
Private Sub Form_Load()
  lngHeight = Me.lstCategory.Height
  Debug.Print lngHeight
End Sub

Public Sub ExpandLst()
  'ht in inches changed to twips
  lstCategory.Height = 3 * 1440
End Sub

Public Sub collapseLst()
 Me.lstCategory.Height = lngHeight
End Sub

Private Sub lstCategory_DblClick(Cancel As Integer)
  collapseLst
End Sub

Private Sub lstCategory_GotFocus()
 ExpandLst
End Sub

Private Sub lstCategory_LostFocus()
  collapseLst
End Sub

Here is a demo
 
With thousands of records to enter, and a limited set of EventIDs to choose from the easiest and fastest entry would be using a listbox. My suggestion was only if you did not want to use a listbox due to real estate contraints.
 
Thanks everyone but a list box would cause redesigning the form and stuff.
 
Thus you may want to look at the code to "Pseudo" make a list box into an expanding combo box.
 
The combo box works and I have auto drop down set up. I was asked about using 1, 2, 3 and so on. But, at this point, I don't think it's totally necessary.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top