none
Report with OLE Field changing with each registry problem exporting to PDF RRS feed

  • Question

  • Hi,

    I have a report with a form as subreport that load a PDF file from the path stored in my table. To do that, I'm copying the stored file to the OLE object source. However, when I'm saving the report as PDF, the event will not trigger entry by entry and all the records will have the same image (the first to load).

    Is there any way to fix this?

    Thursday, July 7, 2016 7:04 PM

All replies

  • I do not understand the statement 'not trigger entry by entry'

    Just to sanity check:

     * Open this report on screen

     * Right click on image and select 'Export' : to PDF / XPS

     * save that PDF in a folder

    does this PDF have the correct info?

    Thursday, July 7, 2016 8:59 PM
  • No. I'm sorry if I wasnt clear, when I'm in preview mode and pass the page the Format event is triggered. However, when I'm exporting it to PDF (using VBA or manually) the Format event is not loaded since I'm not actually passing the pages.
    Thursday, July 7, 2016 10:15 PM
  • Well I'm interested in following this - although at the moment do not have time to set up my own test.  But generically speaking - assuming there is valid VBA code in a report section's OnFormat event: it is my understanding that this will all fire when the report opens on screen.

    So it has fired.  Then when you right click and export to PDF - all the data will be part of that pdf image.

    So if what you are saying is that OnFormat events do not export to PDF that would be a key issue for a lot of users to understand.

    Friday, July 8, 2016 2:46 PM
  • You see: it'll fire when the report open. However, my VBA code change an OLE field based on the ID of the current record, meaning that it needs to fire for every page. When I'm in the report preview and click in the Next button, the OnFormat event will trigger. However, when I try to export to PDF the event will trigger only once: when the report is opened.
    Monday, July 11, 2016 6:03 PM
  • Hi Ticiano,

    >> However, when I try to export to PDF the event will trigger only once: when the report is opened.

    Do you mean after exporting to PDF, the OLE field in other pages did not change based on the ID? I made a test with below steps, the values is correct after exporting to PDF.

    1. Add a TextBox to Report

    2. Add below code:

    Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
    Me.Text28.Value = Me.AreaID
    End Sub

    3. Open Report in Preview,

    4. Click PDF or XPS to export this report

    5. Check the exported report, and find the value is correct for this TextBox.

    Do you have any differences from my steps? It would be helpful if you could share us detailed steps to reproduce your issue.

    Best Regards,

    Edward


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Tuesday, July 12, 2016 5:59 AM
  • The textbox changes, that's not the problem. The problem is the OLE field that loads the PDF document.
    Tuesday, July 12, 2016 11:22 AM
  • As I think I now understand your post; you wish to have linked images in your report - that are exportable to PDF.  To implement this use the following method:

    In your table & form add a new normal Text box field/control with the name 'Pic'

    At a suitable event, such as the OnEnter event of this new control add the FileDialog code:

    Dim strfile As String

           With Application.FileDialog(1)

              If .Show Then

                  strfile = .SelectedItems(1)

              Else

                  MsgBox "No file selected", vbInformation

                  Exit Sub

              End If

          End With

    Me.Pic = strfile

    ..... this code will allow the user to select the file to be the image for the record.  You can of course use some other method but the important result is the string to the image must be in the Pic field.

    Then in your report; add an image control.  Give it the name: Image1  When you drag the image into your report the wizard is going to prompt you to select an image to bind it to.  Do that - but then return to the control's property and blank out the Control Source so it is unbound.

    Next add this code to the OnFormat event of the section of the report containing the Image1 control:

    If Not IsNull(Me.Pic) Then

    Me.Image4.Picture = Me.Pic

    End If

    ............ this will result in a report that displays an image per record - and is fully exportable to PDF.



    Tuesday, July 12, 2016 12:10 PM
  • Well, not exactly this. Instead of a image displayed per record, I want a PDF displayed per record - and then export the resulting report to PDF.
    Tuesday, July 12, 2016 5:51 PM
  • Because the Adobe PDF is a big application, and the file can be multi page - I don't view any attempt to funnel & frame it into an Access record to display is a viable concept.  Nor would I attempt that with a Word doc or an Excel doc.  It is my view that the OLE concept hit that wall a long time back and which is why it is not in use much any more.  But if the PDFs are single page images - the approach above should still work.

    Tuesday, July 12, 2016 10:20 PM
  • Hi Ticiano,

    >> Instead of a image displayed per record, I want a PDF displayed per record - and then export the resulting report to PDF

    Do you mean that you change the OLE field in Format event, and all the OLE field shows the first image? Could you share us why you want to change the OLE Object source in report? I suggest you try to create a table with these new OLE records, and then set this table as the Report data source, and then test it again.

    Best Regards,

    Edward


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Wednesday, July 13, 2016 3:28 AM