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!

Search ComboBox

Status
Not open for further replies.

puppy39

Programmer
Mar 13, 2009
41
US
I created a unbound combo box using the access wizard in order to filter a form based on what is selected in the combo box. The rowsource of the combobox is SELECT LeadID, CompanyName FROM tbl_Leads_Main ORDER BY CompanyName. I want the combo box to display only the CompanyName. The problem is some records will have the CompanyName field with a null value or with a value of "Confidential". When this happens the code stops at the "If Not rs.EOF then Me.Bookmark = rs.Bookmark. I am sure that it does not know what to do since we have several records where the CompanyName has the same value and does not know which one to pick.

How can I make this search for
SSearch = (LeadID = LeadID and CompanyName = CompanyName)
rs.find = sSearch

This is the code how it is now.

Private Sub Combo581_AfterUpdate()
' Find the record that matches the control.

Dim rs As Object

Set rs = Me.Recordset.Clone
rs.Find "[LeadID] = " & Str(Nz(Me![Combo581], 0))
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top