• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1518
  • Last Modified:

Set focus on opne report

I have a form with Popup and Modal set to Yes. I want to be able to double-click a combo box control and open a report in preview mode. The code also sets the focus on a control in the report. When my code executes, the report opens and momentarily has the focus, but the focus then switches back to the form in which the double-click event ran. I have to have my forms remain Modal, so how do I get the report to retain the focus when opening in preview from a modal form?
0
paulmcneil
Asked:
paulmcneil
  • 2
1 Solution
 
mbizupCommented:
You'll have to set the report to modal as well...

Or open it with the windomode argument set to acDialog.

docmd.OpenReport "rptName", View := acViewPreview, WindowMode:= acDialog

Open in new window

0
 
mbizupCommented:
You may also need to set Popup to No on your form - and just leave Modal set to Yes.
0
 
Jeffrey CoachmanMIS LiasonCommented:
A bit more info.

The Modal/Popup properties *Prevent* other windows from opening on top of the form.
So as mbizup states, if you want the report to get the focus, turn off the Modal/popup on the form.

In other words, you cannot have a form stay on top all the time, but yet still allow a Report to be on top.

<The code also sets the focus on a control in the report.>
I don't think this is possible in "Print Preview"
You can however do this in "Report View", but the control will display #Name?
...Code to Open a report in Report view:
   
DoCmd.OpenReport "YourReport", acViewReport
...Then on the Open event of the report do something like this:
    Me.txtSomeControlSetFocus
But you may have to explain a bit more about this requirement.

JeffCoachman
0
 
paulmcneilAuthor Commented:
Thanks mbizup
0

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now