felder25
asked on
PDF open in Full Screen mode from Access
Hi Experts,
I have a report printing to a PDF file, but I want it to open in full screen mode to be displayed on an overhead monitor. I could easily just push Ctrl+L, but I may not always be the one running this database. I have vbMaximizedFocus in my code already, but it displays the same as vbNormalFocus. Any ideas?
Thanks.
I have a report printing to a PDF file, but I want it to open in full screen mode to be displayed on an overhead monitor. I could easily just push Ctrl+L, but I may not always be the one running this database. I have vbMaximizedFocus in my code already, but it displays the same as vbNormalFocus. Any ideas?
Thanks.
Post your code please...
ASKER
Private Sub Command2_Click()
On Error GoTo Err_Command0_Click
Dim strAttach As String
strAttach = "\\Tdmsgc01\Groups\CQES\Ni ck\2012 Olympics\ROverallReport.pd f"
If IsFileOpen(strAttach) = "Open" Then
MsgBox "The 2012 Marketing/Finance Overall Report is already open." & vbCrLf & _
"Please close the PDF file before running the report.", vbCritical
Exit Sub
Else
DoCmd.SetWarnings False
DoCmd.OpenQuery "QRankTable"
DoCmd.OutputTo acOutputReport, "ROverallReport", acFormatPDF, strAttach
ShellExecute 0, vbNullString, strAttach, vbNullString, vbNullString, vbMaximizedFocus
DoCmd.SetWarnings True
End If
Err_Command0_Click:
End Sub
On Error GoTo Err_Command0_Click
Dim strAttach As String
strAttach = "\\Tdmsgc01\Groups\CQES\Ni
If IsFileOpen(strAttach) = "Open" Then
MsgBox "The 2012 Marketing/Finance Overall Report is already open." & vbCrLf & _
"Please close the PDF file before running the report.", vbCritical
Exit Sub
Else
DoCmd.SetWarnings False
DoCmd.OpenQuery "QRankTable"
DoCmd.OutputTo acOutputReport, "ROverallReport", acFormatPDF, strAttach
ShellExecute 0, vbNullString, strAttach, vbNullString, vbNullString, vbMaximizedFocus
DoCmd.SetWarnings True
End If
Err_Command0_Click:
End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
And to be sure, ...
The OutputTo command includes a last argument that will open the file automatically after you create it.
So try this as well:
DoCmd.OutputTo acOutputReport, "ROverallReport", acFormatPDF, strAttach, True
The OutputTo command includes a last argument that will open the file automatically after you create it.
So try this as well:
DoCmd.OutputTo acOutputReport, "ROverallReport", acFormatPDF, strAttach, True
ASKER
This worked perfectly. Thanks!
just curious...
What happened when you added the TRUE argument to the OutputTo command?
What happened when you added the TRUE argument to the OutputTo command?
ASKER
I got the same result with or without TRUE.
ASKER
When I try and run a second report after having one open, I get the following error:
"Run-time error '5': Invalid procedure call or argument."
Any suggestions??
"Run-time error '5': Invalid procedure call or argument."
Any suggestions??
At what line is the error occurring? Where you able to open a second report before this change with the SendKeys?
ASKER
It opens, but it doesn't maximize and gives the error. I think you can only have one PDF maximized at a time. I just put in code to check if any of the reports are open to alert the user to close the current PDF before opening a second report.