Full Version: DoCmd.Maximize doesn't work (sometimes)
UtterAccess Discussion Forums > Microsoft® Access > Access Reports
bill1one
I have a menu form that opens different reports. Here is the code for those reports.

Sub OpenRpt_Open()
DoCmd.Close acForm, "frmMenu", acSaveNo
DoCmd.Maximize
End Function

Sub CloseRpt_Close()
DoCmd.Restore
DoCmd.OpenForm "frmMenu", acNormal
End Function

What is wierd is that they work fine if the Database Window is displayed, but if I do not display the Database Window at startup, then the reports won't maximize like they should.

Any suggestions?
MicroE
There is no reason to close and reopen the frmMenu. Move the code to the OnOpen and OnClose events of the Report.

CODE
Private Sub Report_Close()
    DoCmd.Restore
End Sub

Private Sub Report_Open(Cancel As Integer)
    DoCmd.Maximize
End Sub
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.