Select row in subform based that is clicked in combo box

  • Thread starter Tara via AccessMonster.com
  • Start date
T

Tara via AccessMonster.com

in the main form i have a combox with a dropdown of names. on the subform is
a datasheet list of all the records. I need to click to find the name in the
combobox and then after update, have the subform go to the record and
highlight the record with the record selector.

thanks for your help.
Tara
 
M

Marshall Barton

Tara said:
in the main form i have a combox with a dropdown of names. on the subform is
a datasheet list of all the records. I need to click to find the name in the
combobox and then after update, have the subform go to the record and
highlight the record with the record selector.


Use this kind of code in the combo box's AfterUpdate event
procedure:

With Me.subformcontrol.Form.RecordsetClone
If .RecordCount > 0 Then
.FindFirst "namefield=""" & Me.combobox & """"
If Not .NoMatch Then
Me.subformcontrol.Form.Bookmark = .Bookmark
End If
End If
End With

Be sure to change the names to the ones you are actually
using. Note that I used namefield for the name of the
**field** in the subform's record source table/query, NOT
the name of a control that displays the name on the subform.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top