Return focus to subform when report is closed

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!
 
K

Ken Snell \(MVP\)

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
 
S

Sandi

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top