Return to original record

R

RJF

I have 2 subforms on a main form. I leave subform_01 and go to subform_02,
enter information there. Then, at the click of a button on subform_02, I
want to go back to the exact record I was on in subform_01 before I left
subform_01.

Any ideas?

Thank you,
 
D

Dale Fye

Are the two subforms both open at the same time, or does subform 1 close when
you to to subform 2?

If the form stays open then all you should have to do is set the focus back
to a control on subform1. The code for that would look something like the
following (note that subform1ControlName is the name of the subform CONTROL
on the main form, not the name of the subforms SourceObject):

'this is the code for the button in subform #2
Private sub Button_Click()

me.parent.form.subform1ControlName.Form.SomeControl.Setfocus

End sub

If you are closing subform1 then opening #2, you might want to consider
defining a form level variable that stores the PK value of the record in
subform 1 (set it in the subforms current event). Then, when subform #1 gets
the focus, you could check whether that variable has a value, and if so, find
the record with that PK value and move to it. If you need more help with
this idea, post back.

Don''t forget to rate the post if it was helpful!

HTH
Dale
 
R

RJF

Hi Dale,

I realized that I was setting the record's enable property to false. I
believe I was actually doing this as an easy way to highlight that record so
the user would know that they should be done with it. I believe that's why I
couldn't get back to that record.

Once I set enable to true. It worked perfectly. (Except now I need to
figure out another way to turn the record a different color. I'll work on
that.)

Thank you so much for your help and your quick response.
 
Top