Records show from searching by combo box

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have my primary key as a combo box where you can search for the correct
key. When the user finds the correct key how would I have the rest of the
data show up below it?
 
Use the combo's After Update event.

Private Sub MyCombo_AfterUpdate()
Dim rst As Recordset

Set rst = Me.RecordsetClone
With rst
.FindFirst "[PrimaryKeyField] = " & Me.MyCombo
If Not .NoMatch Then
Me.Bookmark = .BookMark
End If
End With
End Sub

[PriemaryKeyField] should be the name of the field in the form's recordset
that is the primary key.

The above also assumes that key is a numeric field. If it is not, you will
need to use the correct delimiters for the field's data type.
 
Back
Top