Return focus to subform when report is closed

  • Thread starter Thread starter Sandi
  • Start date Start date
S

Sandi

Hi,
I have a form with a tabbed form. Each tab has command buttons on it
and also contains a subform.
I call a report from the command buttons. My problem is when I close
the report, focus is returned to the header of the main form which
contains my primary key for filtering clients.
I would like focus to return to the subform. Should I put some cold
on the close report event?

Thanks in advance!
 
You can set the focus in the report's Close event. You need two SetFocus
steps to do this (note that I'm using generic names):

Forms!NameOfMainForm!NameOfSubformControlOnMainForm.SetFocus
Forms!NameOfMainForm!NameOfSubformControlOnMainForm!NameOfControlOnSubform.SetFocus
 
Put focus to the object on the form right after the statment where you are
priting the report. e.g

DoCmd.OpenReport "Your Report Name"
Me.ObjectName_on_your_form.setFocus

I hope this will solve your problem

Great, I will try those suggestions!
Thanks a lot!

Sandi
 
Back
Top