maintaining current record when changing focus in forms

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am creating several forms in Access that will be tracking documents that
are emailed to certain distribution groups. I will be creating security for
these different groups but my question doesn't to do with that as yet. I am
wondering that when I create macros that move from form to form and a form
gets minimized, how to bring that form back up at the current record. So fo
instance I am on record number 50 on my Transmittal Form and I swith to the
Approvals form in a macro and when the macro is complete it brings the
Transmittal Form back up. I want the transmittal form to remain at record
50. Currently it goes back to the first record. Any help would be
appreciated.

Thanks in advance,

Getting Better at Access
 
Hi,



"Remember" the value of the primary key ( in a global variable) before
calling the subroutine (or as first thing done in the subroutine) and, once
back, "find and go to" the record with that value you previously saved.


Hoping it may help,
Vanderghast, Access MVP
 
I don't think that will do it. How would write the code to tell it to go to
the last record that was there. It may not be the last record saved for the
user has the option of searching for a record, then emailing it through a
macro and the macro is to bring the form back up only at the last known
record.

See what I mean. I don't know how to do this through the interface so if
you would help with the code, i'd be forever in your debt. (lol)

Thanks again,

Getting Better at Access
 
Hi,



One possible solution is:


Me.RecordsetClone.FindFirst "PrimaryKeyFieldNameHere=" &
globalVariableNameHere
Me.Bookmark= Me.RecordsetClone.Bookmark


assuming the primary key is numerical; if it is a text value, would be:

Me.RecordsetClone.FindFirst "PrimaryKeyFieldNameHere=""" &
globalVariableNameHere & """"

I also assume globalVariableNameHere is the variable into which you saved
the primary key value, before.

Hoping it may help,
Vanderghast, Access MVP
 
Back
Top