A little background (because who doesn't love a story?):
I've got an Access-based application -- not built by me -- that our company uses to run invoices, keep track of inventory, generate purchase orders, etc.
Said application also allows us to run various reports, with fixed parameters. I was asked to create a report that would take variable parameters, which could be entered into a form. So far, so good.
My boss wanted to be able to call up this form from the "Reports" window. Not really how that works (since the Reports window has two options: Preview and Print the reports in the menu), but I came up with a work around.
I created a blank report, which has a DoCmd.OpenForm statement that calls up my data entry form in the OnOpen event. Works exactly as planned.
Except . . . my blank report, which is opening in acPreview mode, stays open. My boss has to manually close it by hitting the little red Windows "X." I've been trying to figure out how to close the blank report after my form is launched, but I'm missing something. If I place a DoCmd.Close acReport immediately after the DoCmd.OpenForm, I get an error that basically says I can't do that. I thought I had my solution by placing my DoCmd.Close acReport statement in the OnActivate event of the report (since that would happen after the OnOpen event), but that doesn't appear to work. The blank report stays open in acPreview mode. I'm kind of thinking the newly-opened form is keeping my report from getting to the OnActivate stage, but I don't know where to go with that.
Any thoughts on this?
I've got an Access-based application -- not built by me -- that our company uses to run invoices, keep track of inventory, generate purchase orders, etc.
Said application also allows us to run various reports, with fixed parameters. I was asked to create a report that would take variable parameters, which could be entered into a form. So far, so good.
My boss wanted to be able to call up this form from the "Reports" window. Not really how that works (since the Reports window has two options: Preview and Print the reports in the menu), but I came up with a work around.
I created a blank report, which has a DoCmd.OpenForm statement that calls up my data entry form in the OnOpen event. Works exactly as planned.
Except . . . my blank report, which is opening in acPreview mode, stays open. My boss has to manually close it by hitting the little red Windows "X." I've been trying to figure out how to close the blank report after my form is launched, but I'm missing something. If I place a DoCmd.Close acReport immediately after the DoCmd.OpenForm, I get an error that basically says I can't do that. I thought I had my solution by placing my DoCmd.Close acReport statement in the OnActivate event of the report (since that would happen after the OnOpen event), but that doesn't appear to work. The blank report stays open in acPreview mode. I'm kind of thinking the newly-opened form is keeping my report from getting to the OnActivate stage, but I don't know where to go with that.
Any thoughts on this?