Combo Box selection

  • Thread starter Thread starter Igor G.
  • Start date Start date
I

Igor G.

I have form with data from tblEmployees:
txtID, cboName, txtPosition…
How to, when I change cboName form refresh data to selected record.
Also I have in this form subform with link fields to txtID.
Thanks!
 
You need to add an *unbound* (no control source) combo box to
your form in, for example, the header section. This combo box would
have properties like the following;

Row Source - Select ID, LastName & ", " FirstName As FullName From
tblEmployees OrderBy tblEmployees.LastName

Bound Column - 1
Column Count - 2
Column Widths - 0", 1.5" (or whatever works best for you)

Then in the After Update event of this combo box you would have code like;

Private Sub cboSearch_AfterUpdate()

With Me.RecordsetClone
.FindFirst "ID = " & Me!cboSearch
If Not .EOF Then
Me.BookMark = .BookMark
Else
MsgBox "No record Found"
End If
End With

End Sub

If you're not familiar with any of the above you can use the combo
box wizard and choose the option "Find a record on my form that
matches the value in my combo box" (or something like that).
 
Back
Top