MajP
You've got your good things, and you've got mine.
- Local time
- Today, 09:58
- Joined
- May 21, 2018
- Messages
- 8,992
In relation to this thread
I wanted to demo this. So I select a report and export to the current folder. That works fine. Then I want to display that in the web browser, and sometimes it works but most of the time it does not. The problem is not with Access but with adobe.
This is the error from Adobe. Nothing is trapped in VBA
But sometimes it works and loads. Only certain reports work.
I tried doing the do events loop, but I believe it never exits and nothing ever renders.
Any Ideas? Thanks.
Display report on the form
Hi In Access, you can display reports within a form and control them using the form, such as printing specific pages or navigating to a particular page. Thank you
www.access-programmers.co.uk
I wanted to demo this. So I select a report and export to the current folder. That works fine. Then I want to display that in the web browser, and sometimes it works but most of the time it does not. The problem is not with Access but with adobe.
Code:
On Error GoTo CmboReport_AfterUpdate_Error
Dim rptName As String
Dim FullPath As String
Dim cs As String
If Not IsNull(Me.CmboReport) Then
rptName = Me.CmboReport
FullPath = CurrentProject.Path
FullPath = FullPath & "\" & rptName & ".pdf"
exportPDF rptName, FullPath
cs = "= " & Chr(34) & FullPath & Chr(34)
Me.wbBrowser.ControlSource = cs
DoEvents
'Do While Me.wbBrowser.Object.Busy Or Me.wbBrowser.Object.ReadyState <> 4
' DoEvents
'Loop
Me.wbBrowser.Object.Refresh
End If
On Error GoTo 0
Exit Sub
CmboReport_AfterUpdate_Error:
MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure CmboReport_AfterUpdate, line " & Erl & "." & vbCrLf & "ControlSource " & cs
End Sub
Private Sub exportPDF(ReportName As String, FullPath As String)
On Error GoTo exportPDF_Error
Dim fileName As String
DoCmd.OutputTo acOutputReport, ReportName, acFormatPDF, FullPath
On Error GoTo 0
Exit Sub
exportPDF_Error:
MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure exportPDF, line " & Erl & "."
End Sub
This is the error from Adobe. Nothing is trapped in VBA
But sometimes it works and loads. Only certain reports work.
I tried doing the do events loop, but I believe it never exits and nothing ever renders.
Any Ideas? Thanks.
Attachments
Last edited: