Stay with Current Record

T

Tee See

Here we go again ......

Currently have a form "frmMainform" with subform "frmSubForm" where/when
there is no data in the subform I CLICK on a button to invoke a
"frmPopUpForm" to add info to the subform table which is bound. After close,
the requery statement takes place and requeries but returns the
"frmMainForm" and the related "frmSubform" to the first record of the
"frmMainForm".
How do I stay with the same record I was viewing when I invoked the
"frmPopUpForm"?

Regards
 
J

John Spencer

Store the primary key of the current record
Then do the requery
Then find the record that has the primary key.

Something like the following UNTESTED AIRCODE.

Dim lngPK as Long

lngPK = Me.PrimaryKey

Me.Requery

With Me.RecordsetClone
.FindFirst "PrimaryKey = " & lngPk
if .NoMatch = False then
Me.BookMark = .Bookmark
End if
end With
 
Top