The "trick" to doing this is to store the primary key field's value before
you do the requery, then move to the record with that primary key value:
DoCmd.Close
Dim varKey As Variant
a = Forms!Agreements.KeyAgreement
varKey = Forms!Agreements.PrimaryKeyField.Value
Forms!Agreements.Requery
Forms!Agreements.RecordsetClone.FindFirst "PrimayKeyField=" & varKey
Forms!Agreements.Recordset.Bookmark =
Forms!Agreements.RecordsetClone.Bookmark
DoCmd.GoToRecord , , acNext
DoCmd.GoToControl "SENT_DATE"
--
Ken Snell
<MS ACCESS MVP>
"Newboy" <(E-Mail Removed)> wrote in message
news:049d01c42497$2dd40db0$(E-Mail Removed)...
> Hi, I am stuck, plelase help.
> I have a Continuous form and a button that does a
> function, after the function is complete I need to
> refresh the form and return to the record I was at.
> This is what I have so far:
>
> DoCmd.Close
> a = Forms!Agreements.KeyAgreement
> Forms!Agreements.Requery
> DoCmd.GoToRecord , , acNext
> DoCmd.GoToControl "SENT_DATE"
>
> The first 3 line work fine, I just can't get the
> GoToRecord to work.
|