Hi everyone,
Happy Holidays and Merry Christmas to all.
I am trying to open a report that has a few things going on.
1) The report is executed from a command button on the main menu.
2) A custom tool bar with only two icons (close and print). This seems to work fine.
However, I also want the report to open within the window in preview mode. Then upon printing or closing the report, have it show the main menu in it's original location and size.
I am using the following code on the "On Click" event of the command button:
I then use this code to close the report:
As soon as I click the command button I receive the following error:
The command or action 'fit to window' is not available now. Then the report opens in maximize mode. When I click the close button on the custom tool bar the main menu shows up also in maximized mode.
Any suggestions?
Thanks
Dom
Happy Holidays and Merry Christmas to all.
I am trying to open a report that has a few things going on.
1) The report is executed from a command button on the main menu.
2) A custom tool bar with only two icons (close and print). This seems to work fine.
However, I also want the report to open within the window in preview mode. Then upon printing or closing the report, have it show the main menu in it's original location and size.
I am using the following code on the "On Click" event of the command button:
Code:
Private Sub Report_Open(Cancel As Integer)
On Error GoTo Err_Report_Open
DoCmd.ShowToolbar "GrantTrainkingPrintPreview", acToolbarYes
DoCmd.OpenReport "rptAllProjects", acViewPreview
DoCmd.Maximize
DoCmd.RunCommand acCmdFitToWindow
'The number at the end represents the % zoom
DoCmd.RunCommand acCmdZoom75
If IsLoaded("frmSwitchboard") Then Forms!frmSwitchboard.Visible = False
Exit_Report_Open:
Exit Sub
Err_Report_Open:
MsgBox Err.Description
Resume Exit_Report_Open
End Sub
I then use this code to close the report:
Code:
Private Sub Report_Close()
On Error GoTo Err_Report_Open
DoCmd.ShowToolbar "GrantTrainkingPrintPreview", acToolbarNo
If IsLoaded("frmSwitchboard") Then Forms!frmSwitchboard.Visible = True
Exit_Report_Open:
Exit Sub
Err_Report_Open:
MsgBox Err.Description
Resume Exit_Report_Open
End Sub
As soon as I click the command button I receive the following error:
The command or action 'fit to window' is not available now. Then the report opens in maximize mode. When I click the close button on the custom tool bar the main menu shows up also in maximized mode.
Any suggestions?
Thanks
Dom