Link to home
Start Free TrialLog in
Avatar of felder25
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.
Avatar of Jeffrey Coachman
Jeffrey Coachman
Flag of United States of America image

Post your code please...
Avatar of felder25
felder25

ASKER

Private Sub Command2_Click()
On Error GoTo Err_Command0_Click

Dim strAttach As String
strAttach = "\\Tdmsgc01\Groups\CQES\Nick\2012 Olympics\ROverallReport.pdf"

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
Avatar of IrogSinta
IrogSinta
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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
This worked perfectly. Thanks!
just curious...

What happened when you added the TRUE argument to the OutputTo command?
I got the same result with or without TRUE.
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??
At what line is the error occurring?  Where you able to open a second report before this change with the SendKeys?
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.