Results 1 to 3 of 3
  1. #1
    kingdoz is offline Novice
    Windows XP Access 2007
    Join Date
    Nov 2011
    Posts
    6

    Renaming a report before SendObject

    I really need some help if someone knows how, as have been tearing my hair out trying to work out how to rename a report from the name of the Report itself to one which takes the detail from a field called 'Invoice No' and renames the PDF to that before emailing.

    I am no good with VBA (I dont even know how to start), so in a Macro I have the following. It all works just fine, but it sends the PDF name as 'InvoiceEmail' which is the report name itself. I really want it to change the name of the PDF to [Invoice No].pdf

    Action 1: Open Report
    Report name: InvoiceEmail
    View: Print Preview


    Where Condition: [Invoice No]=[Forms]![Invoices]![Invoice No]

    Action 2: SendObject
    Object Type: Report
    Object Name:
    Output Format: PDF Format [*.pdf]
    To: =[Email]
    Subject: =[Invoice No]
    Message: blah blah

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    You could try OutputTo instead of SendObject
    http://social.msdn.microsoft.com/For...5-2984825a60be
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    kingdoz is offline Novice
    Windows XP Access 2007
    Join Date
    Nov 2011
    Posts
    6
    Ctually I just found out a much easier way to do it.

    In the report itself, In Properties, In Format, if you fill in the Caption then it will SendObject with the Caption Name. The way I did it is by writing a tiny peice of VBA.

    I clicked Event Tab in properties, then chose On Load, and put in just 1 line of code:

    Reports("InvoiceEmail").Caption = [Invoice No]

    Perfect, now it renames the PDF to the Caption Name

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

Similar Threads

  1. Renaming Utility
    By bginhb in forum Access
    Replies: 3
    Last Post: 11-02-2011, 03:11 PM
  2. Renaming a file using VBA
    By bfaucher in forum Programming
    Replies: 1
    Last Post: 11-01-2011, 02:56 PM
  3. Renaming fields
    By WilsonsW in forum Access
    Replies: 10
    Last Post: 03-25-2011, 01:20 PM
  4. Renaming Fields on Table or Query
    By jo15765 in forum Access
    Replies: 4
    Last Post: 12-09-2010, 01:47 PM
  5. SendObject
    By weshader in forum Access
    Replies: 1
    Last Post: 11-09-2009, 04:19 PM

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