Tom van Stiphout said:
On Tue, 7 Jul 2009 21:32:01 -0700, hughgoagogo
I understand you have a form with the same RecordSource as its
subform. The subform is likely in datasheet view and is used as a list
of records to select from. When the record selector of a row is
double-clicked, you want the form to reflect that row.
Yes, that can be done with a few lines of VBA. In the subform's
Form_DblClick event write:
(off the top of my head)
Me.Parent.Bookmark = Me.RecordsetClone.Bookmark
Are you sure that will work, Tom? It seems to me that the parent form's
Bookmark will not be compatible with the subform's Bookmark, because their
recordsets are opened independently of each other (even though they are
based on the same query).
If the above line of code doesn't work, you can use the parent form's
Recordset property to locate the matching record, by doing a FindFirst on
the matching primary key:
Me.Parent.Recordset.FindFirst "ID=" & Me.ID
.... where "ID" is the name of the form and subform's primary key field. If
that field is a text field, you will have to enclose it in quotes; e.g.,
Me.Parent.Recordset.FindFirst "ID=" & Chr(34) & Me.ID & Chr(34)