Hi,
Maybe I am not understanding what you want, but it sounds like you want to use a combo box so the user can browse records on a form. If that is the case, then just use the Combo Box wizard. At the first prompt, check the radio button that says you want to find a record on your form using the combo box.
Then on the Form's On Click event, put this code to synchronize the combo box with the records:
cboComboBoxName = RecordPrimaryKeyName
This will allow the user to use the combo box to find a record. The code attached to the combo box After Update event looks like this:
' Find the record that matches the control.
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[PK] = " & Str(Nz(Me![ComboName], 0))
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
IMPORTANT: The combo box Row Source is a query that looks up the value(s) you want the user to browse by. The bound column is usually the Primary Key.
I hope this helps.
mmcdonal
|