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

Force combo box open when duplicate fields

Status
Not open for further replies.

gusbrunston

Programmer
Feb 27, 2001
1,234
US
[tt]
Hi!

Combo box has list of names, ID numbers, other profile data.

User enters name, then other fields on the form are populated based on the name entered.

In the event of duplicate names, after entering the name, user CAN but WON'T use down arrow to see the duplicate names with other unique identifying fields.

How can I REQUIRE the combo box to drop down and display duplicate names, encouraging user to select the correct record?

That is, I need to use VBA in the AfterUpdate event, to open that combo box. Like...[/tt]

If there are duplicate names in the underlying query then,
   force the combo box  to open displaying duplicates  
End if  
Exit Sub[tt]

Or is there another, better way to accomplish the same thing?

Thank you for your attention to this post. I appreciate your help.

Cheers,Gus[/tt]


[tt]Gus Brunston[/tt]
 
Use the DropDown method of the ComboBox.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
How are ya gusbrunston . . .

In parallel with [blue]PHV[/blue], in the [blue]On Got Focus[/blue] & [blue]On Lost Focus[/blue] events of the combo enter
Code:
[blue]   Me![purple][B][I]ComboboxName[/I][/B][/purple].DropDown[/blue]
Note: the DropDown method is a toggle!

[blue]Your Thoughts? . . .[/blue]

See Ya! . . . . . .

Be sure to see thread181-473997 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
Private Sub Combo0_BeforeUpdate(Cancel As Integer)
Dim strLastName As String
Dim intCount As Integer
Dim strMsg As String
strLastName = Combo0.Column(1)
intCount = DCount("lastName", "tblEmployees", "lastName = '" & strLastName & "'")
If intCount > 1 Then
strMsg = "There are " & intCount & " people with the lastName of " & strLastName & "."
strMsg = strMsg & vbCrLf & "Would you like to verify that you have the correct " & strLastName
If MsgBox(strMsg, vbYesNo) = vbYes Then
Cancel = True
Combo0.Dropdown
End If
End If
End Sub
 
Hi:

Many thanks to all who replied to my post. I haven't had a moment to try any of the solutions offered, but it looks like I've gotten worthwhile suggestions from all.

Thanks again,

Gus

[tt]Gus Brunston[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top