Angus said:
Thanks for your reply.
I do not necessarily want to go to a record *X*, rather I want to go
to a record where MyControl is the same value os before the requery.
The reason for this is that another form, which will be requeried
after the first, will display records depending on the record that
has the focus in the first form.
Okay, that's perfectly reasonable. The easiest way to do this is with
VBA code, not a macro, because macros don't let you define local
variables. I would do it like this:
'----- start of example code (Access 2000 or later) -----
' Declare a variable to hold the current record's key.
Dim vMyControlValue As Variant
' Save the current record's key.
vMyControlValue = Me.MyControl
' Requery the form.
Me.Requery
' Find the record whose key we saved.
Me.Recordset.FindFirst "MyControlField=" & vMyControlValue
'----- end of example code -----
In the above, "MyControl" is the name of the bound control containing
the record key, and "MyControlField" is the name of the field to which
that control is bound. These names may or may not be the same.
If the original record is no longer in the form's recordset, the above
code will leave the requeried form positioned at the first record.