Minimize Access on report close

Vassago

Former Staff Turned AWF Retiree
Local time
Today, 18:09
Joined
Dec 26, 2002
Messages
4,696
I keep Access minimized until a report is open. When a report is open, I run the following code:

DoCmd.RunCommand acCmdAppMaximize
DoCmd.Close acForm, "frm_onlinereports"
DoCmd.OpenReport "report1", acViewPreview

All works fine. Access maximizes to allow my report to be shown with my custom toolbar. The problem lies in minimizing access when the report is closed. I run the following code:

DoCmd.ShowToolbar "ReportView", acToolbarNo
DoCmd.RunCommand acCmdAppMinimize
DoCmd.OpenForm "frm_onlinereports"

I get an error at acCmdAppMinimize. The error says."The command is not available now. Why not? Am I doing something wrong? I've tried what I can think of. Any ideas?

Thanks!

Vassago
 
Have you tried this code instead assuming what you're trying to do is maximize the Report Preview window ?

DoCmd.OpenReport "report1", acViewPreview
DoCmd.RunCommand acCmdFitToWindow

HTH JT
 
Thanks for the reply. Maybe I didn't clarify correctly. The problem is minimizing Access after the report is closed. I get the error message on the OnCLose procedure. The maximizing works fine. Any other ideas?

Vassago
 
I was trying to get you you to Maximize the report and then you wouldn't need to min and max Access itself. Then you wouldn't get that error which I can't find details about. JT
 
My database runs with Access minimized. In order to view the report at all, Access must not be minimized. I need to maximize Access to even see the report. (or at least Restore it).

I now have the problem straightened out though. It seems Access doesn't like to minimize during a report close until there is something else left to show. I simply changed my code around. Thanks for the advice though!

Vassago
 
I had to close and reopen the form, which has the acCmdAppMinimize in its "on open" handler. that does it. how did you change your code to make it work?

thx!
 

Users who are viewing this thread

Back
Top Bottom