Results 1 to 6 of 6
  1. #1
    James Kelley is offline Novice
    Windows 10 Access 2016
    Join Date
    Apr 2020
    Location
    Falls Church, VA
    Posts
    3

    Exclamation Images not displaying when printing using vba code

    I have created a 2 page report with two images on the first page. One is an embedded image (our company logo) in the page footer, and the other is a hyperlink image in the detail based on the link in a field of the query used as a record source. To make sure the hyperlink for the 2nd image works properly, in the On Format event of the detail I have code: If Me.imgPhoto.Picture <> "(none)" Then Me.imgPhoto.Picture = Me!lnkPhotoLocation.



    When I access the report through the navigation pane and print preview, then print to pdf, everything works wonderfully.

    I have used both of the code strings below, but using either results in only one image showing (and it is inconsistent which image shows). The first iteration did work once. Once!

    First iteration:
    Dim PauseTime, Start
    PauseTime = 15
    DoCmd.OpenReport strRpt1, acViewReport
    Do While Timer < Start + PauseTime
    Loop
    strNewFile1 = strReportFolder & strRpt1 & ".pdf"
    DoCmd.OutputTo acOutputReport, strRpt1, acFormatPDF, strNewFile1, , , , acExportQualityPrint
    DoCmd.Close acReport, strRpt1

    Second iteration:
    DoCmd.OpenReport strRpt1, acViewReport
    DoCmd.RunCommand acCmdPrint
    DoCmd.Close acReport, strRpt1

    I am at a loss as to how to make the report work correctly! Any help would be greatly appreciated.

  2. #2
    Gicu's Avatar
    Gicu is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,115
    Can you try:
    Code:
    Dim PauseTime, Start
    PauseTime = 15
    DoCmd.OpenReport strRpt1, acViewPreview,,acHidden
    Do While Timer < Start + PauseTime
    Loop
    strNewFile1 = strReportFolder & strRpt1 & ".pdf"
    DoCmd.OutputTo acOutputReport, , acFormatPDF, strNewFile1, , , , acExportQualityPrint 'no report name provided will output the active one
    DoCmd.Close acReport, strRpt1
    Cheers,
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  3. #3
    James Kelley is offline Novice
    Windows 10 Access 2016
    Join Date
    Apr 2020
    Location
    Falls Church, VA
    Posts
    3
    Hi Vlad,

    Thank you for the help! Actually I should have said how many iterations of this code I've been through. I had the code setup like you demonstrated initially in Preview-Hidden, and that didn't work either. Argh.

  4. #4
    Gicu's Avatar
    Gicu is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,115
    Hi James,

    Just another thought about your report, how big are the pictures? I used to have a report with up to three pics to be inserted dynamically like you do it and found out that it was behaving inconsistently if the pics were more than 1.5-2 MB each. Try to reduce their size and give it a try.

    Cheers,
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  5. #5
    James Kelley is offline Novice
    Windows 10 Access 2016
    Join Date
    Apr 2020
    Location
    Falls Church, VA
    Posts
    3
    Vlad that is looking promising! So far it is working, but I've learned to be cautiously optimistic with printing with Access!

  6. #6
    Gicu's Avatar
    Gicu is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,115
    So you ended up reducing the size of the picture files?

    Cheers.
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 7
    Last Post: 03-22-2020, 02:05 PM
  2. OLE Object not displaying images anymore
    By SierraJuliet in forum Access
    Replies: 2
    Last Post: 01-27-2019, 11:35 PM
  3. Attachment Images displaying Sideways
    By Scalec in forum Forms
    Replies: 4
    Last Post: 07-06-2017, 06:25 PM
  4. Replies: 2
    Last Post: 11-19-2016, 07:21 PM
  5. Displaying images from another folder
    By w3leon in forum Access
    Replies: 0
    Last Post: 01-30-2009, 06:18 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums