I am using Access 2003 and I have a form that collects some filtering criteria for the report. Once the criteria is entered the user clicks and “OK” button and the report is launched using the following VBA.
DoCmd.OpenReport "ReportName", acViewPreview
After the report is opened I issue the following command to close the form that collected the filtering criteria …
Me.Close
The form closes however the report, which I wanted to stay open in the foreground, is hidden. Any idea why this is happening?
When all else fails with forms and reports coming to the front at the desired time, you can do it explicitly with DoCmd.SelectObject:
If that doesn’t work, there’s something else involved, like forms or reports opened with the acDialog switch, or with forms/reports having the Modal or Popup properties set to True.
Or, there might be a timer running somewhere that’s causing something to happen that’s grabbing focus.