How can I restore focus back to a report?

richy240

Registered User.
Local time
Today, 17:05
Joined
Oct 23, 2003
Messages
16
I am trying to launch a report based on the values in a form, then close the form. Unfortunately, I am running into a very serious problem (from a user's point of view): Focus (of the report) is lost to the Main Menu form.

That is, each time I launch the report ("rpt_assignments_created"), the form that launched it ("frm_dates") closes as expected. Then the Main Menu ("frm_main") gets Focus. How can I restore focus to the report window ("rpt_assignments_creates")?

Thanks in advance.
 
Sounds like your form has code that sets the focus to Main Menu when it closes.

One trick is to make the Forms Visible Property = False and then close it using the Docmd to close the form when the Report is Closed (Report_Close Event). This will allow the forms set focus code to work and make sure the the Report Form is closed when you are done.

Travis
 
Travis said:
Sounds like your form has code that sets the focus to Main Menu when it closes.

I would seem that this is the case, but it is not. There is no code in the Close event of the form, or any other event for that matter. The only code in the form's scope is on the buttons: One button (labeled "Run Report!") launches the report and the other (labeled "Cancel") closes the form.

I have solved this in a rather creative manner, but I would expect there to be a much more direct way to approaching this problem. My solution is as follows:

I set the visibility of the Main Menu to false when the "Run Report" button is clicked. Then, when the report is closed, I use the DoCmd.OpenForm method to restore visibility back to True, or open the form (whichever is necessary, as recommended by a UtterAccess member).

This works wonderfully, but like I said, I expect that there is a more direct way of doing this.

Please advise. Thanks.
 

Users who are viewing this thread

Back
Top Bottom