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!

Expanding Combo boxes

Status
Not open for further replies.

davidrsutton

Programmer
Oct 6, 2004
94
GB
Hi...

I have a combo box on a form that is populated with a list of names. The user can type in the combo box and it obviously auto fills in the rest of the name if there is a match.

the problem is, some people have the same name. And instead of users having to type in the name, then click on the combo box to expand it to check there is not 2 people of the same name, it would be really good if when all the time the combo box has focus, that the drop down list would permanently (while it has focus) display all the names so that users can see duplicate people at a glance.

Hope that makes sense, and any help or ideas would be most appreciated!

Thanks in advance,

Dave
 
Perhaps:
Code:
Private Sub cboCombo_Change()
Me.cboCombo.Dropdown
End Sub

Or you may wish to use a Listbox.
 
Try the GotFocus event procedure:
Private Sub cboCombo_GotFocus()
Me!cboCombo.Dropdown
End Sub

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
cheers for your suggestions guys... I'll give 'em a go and let you know how I get on.

Dave
 
I thought about using a listbox but the problem is that you cant jsut type the name you want as you have to physiacally click it.

What would be good though would be as you're typing thre name in the combo box, a listbox directly underneath lists all the names that match what you've typed. That way, the users can see at a glance if there are 2 people who share the same name... anyone have any idea how I might go about this? I've just had a little fiddle but couldn't get it to work.

Thanks again,

Dave
 
So, how would that help with 3 John Smith's? I had 3 John Smith's work for me at AT&T once. This is why names are bad to key on.
 
Because along with their name, the combo box displays the person's postcode and phone number.

Obviously every person has a unique ID, but the users unfortunately do not know the unique ID when doing the data entry, they do just have a name and a postcode.
 
Perhaps if you used something like this for the listbox:
Code:
Private Sub cboCombo_AfterUpdate()
Me.lstList.RowSource = "Select Surname, Forename From tblPersons Where Surname = '" _
    & Me.cboCombo.Column(1) & "' And Forename ='" & Me.cboCombo.Column(2) & "'"

Where there are at least three columns in the combo (0,1,2).
 
Cheers for all your help guys... I've gone with Remou's solution as that fits the bill perfectly!

Thanks again,

Dave
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top