combo box search

  • Thread starter Thread starter ryan.fitzpatrick3
  • Start date Start date
R

ryan.fitzpatrick3

I imagine this is really easy, I have a combobox that is linked to a
supplier table recordset. Is there away to click the recorset in the
combobox and make that supplier information pop up? Right now I have
the cbox populated with the date but upon click it doesn't bring the
respective recordset up.

I have.

Private Sub cboxsearch_Click()
On Error GoTo Err_cboxsearch_Click

DoCmd.GoToRecord , , ???????

Exit_cboxsearch_Click:
Exit Sub

Err_cboxsearch_Click:
MsgBox Err.Description
Resume Exit_cboxsearch_Click
End Sub
 
Well, I'd use the On Change event rather than the On Click event, but that's
just me. I think you need to execute an ADO query to bring up that
information. Either that or set a filter based on the value of the bound
column in the combobox.
 
Typically when you want to use a combo box to search for records, you use
an *unbound* combo box. The combo box Control Source property would be
blank and the Row Source would look something like;

SELECT SupplierID, SupplierName FROM tblSuppliers ORDER BY SupplierName

Then in the *After Update* event (not the Click or the Change event) you
would use code such as;

Private Sub cboxsearch_AfterUpdate()

With Me.RecordsetClone
.FindFirst "SupplierID=" & Me.cboxsearch
If Not .NoMatch Then Me.Bookmark = .Bookmark
End With

End Sub
 
Back
Top