Giving the focus to a report

  • Thread starter Thread starter mattthr
  • Start date Start date
M

mattthr

Guest
Hi,

Having forced a form to close after generating a report, I find that (of
course) the focus is taken away from the report, given to the form as it
gets closed and is then given the oldest object available, which happens to
be the 'default' form through which the user gets at the database. The
report is thus open but hidden. How can I make sure the focus goes back to
the report after the form closes? I've tried putting:

Private Sub Form_Unload(Cancel As Integer)
DoCmd.SelectObject acReport, "Date or Delivery Ref Query", True
End Sub

In the form code, but although the code is valid, it doesn't give the focus
back to the form. It doesn't work if you swap 'true' for 'false' either.

Cheers
 
Has anyone had any luck with this? I'm trying to do something similar, creating a dialog form that is used to provide criteria for forms and reports that can be created by my users. Once the report/query is ran, the form closes, but the query/report then loses focus and they are instead returned to the main form (a bit confusing to the user to say the least). If I hide the form instead of closing, it causes the same effect. I can't seem to find any way to force the query/report back into focus. I'm getting desperate and getting ready to see if I can do anything with SendKeys, but this is obviously not where I want to go.
 

Users who are viewing this thread

Back
Top Bottom