Results 1 to 5 of 5
  1. #1
    JrMontgom is offline Competent Performer
    Windows Vista Access 2010 32bit
    Join Date
    Sep 2012
    Location
    Vero Beach, FL USA
    Posts
    124

    Output a report whose output is reformatted in PDF format

    I have created a report and it outputs to the screen and printer with no problem. I want to output the report reformatted in PDF format so I can attach to an email and send to various users. I don't want to send them the Report as an Access 2010 object but I want them to be able to view the report in Adobe Acrobat form using the AA reader. Appreciated any help as I have tried the DoCmd.SendObject and Docmd.OutputTo but I can't seem to get it right. Thanks for any help as I am very confused at the moment.

  2. #2
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862

  3. #3
    JrMontgom is offline Competent Performer
    Windows Vista Access 2010 32bit
    Join Date
    Sep 2012
    Location
    Vero Beach, FL USA
    Posts
    124
    Quote Originally Posted by ItsMe View Post
    Yes and thanks. I really think the Help for this command needs to really stress the fact you need to Open the report and select the report before the SendObject as shown in the example above and code below. Sometimes the SendObject will work without these commands but it isn't consistent and will drive you crazy. ;-)


    Code:
      DoCmd.OpenReport "strReport", acViewPreview, , strWhereDoCmd.SelectObject acReport, "strReport", False
    DoCmd.SendObject acSendReport, strReport, acFormatPDF, strTo, strCc, strBcc, strSubject, strBody, True
    DoCmd.Close acReport, "strReport"

  4. #4
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    docmd.selectobject should not be necessary if focus is already on the object or you explicitly describe the object in the docmd statement by name.

    It goes for other docmd also

    Docmd.Close
    or
    docmd.close acform, "FormName"

    If you have other code running, it is possible for the app to lose focus of the report before having a chance to send it. So I usually add the docmd.selectobject. Another approach may be to use Doevents. Althouth, I have not tested this approach.

  5. #5
    JrMontgom is offline Competent Performer
    Windows Vista Access 2010 32bit
    Join Date
    Sep 2012
    Location
    Vero Beach, FL USA
    Posts
    124

    Sending Report as an attachment in email

    Quote Originally Posted by ItsMe View Post
    docmd.selectobject should not be necessary if focus is already on the object or you explicitly describe the object in the docmd statement by name.

    It goes for other docmd also

    Docmd.Close
    or
    docmd.close acform, "FormName"

    If you have other code running, it is possible for the app to lose focus of the report before having a chance to send it. So I usually add the docmd.selectobject. Another approach may be to use Doevents. Althought, I have not tested this approach.
    Once again thanks for all your help although it shouldn't be necessary if object has focus I feel it is best to use the DoCmd.SelectObject, Close as it insures that the code works! Well worth the typing and no error or worst yet randomly working or not working. Thanks

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

Similar Threads

  1. Replies: 4
    Last Post: 12-30-2013, 05:51 PM
  2. Output format in SendObject Macro
    By nhkhurum in forum Macros
    Replies: 11
    Last Post: 12-21-2013, 02:09 PM
  3. Managing Text Output Format in Notepad
    By dynamictiger in forum Programming
    Replies: 1
    Last Post: 08-07-2013, 03:40 PM
  4. Replies: 1
    Last Post: 02-12-2013, 09:12 AM
  5. Querry IIf Output Format (Access 2003)
    By Bruce in forum Access
    Replies: 2
    Last Post: 12-03-2009, 06:52 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