Results 1 to 3 of 3
  1. #1
    Oxygen Potassium is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2016
    Posts
    40

    DoCmd.SendObject Stops Macro When Report is not Created

    I have a function built to send a report to a specific department based on a table.

    Example:



    DoCmd.SendObject acReport, "Report #1", "PDFFormat(*.pdf)", DLookup("[Table Field]", "Table", "Criteria = 'Department 1'')...
    DoCmd.SendObject acReport, "Report #2", "PDFFormat(*.pdf)", DLookup("[Table Field]", "Table", "Criteria = 'Department 2'')...
    DoCmd.SendObject acReport, "Report #3", "PDFFormat(*.pdf)", DLookup("[Table Field]", "Table", "Criteria = 'Department 3'')...

    The problem I have is the reports are conditioned to not produce if no results are found, using the 'on no data' event. If the report is not produced the function stops running there. How can I either bypass this error or reconfigure to exclude blank reports another way?

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,521
    For the first in in the code put:

    on error resume next

  3. #3
    Oxygen Potassium is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2016
    Posts
    40
    Thanks ranman

    I added in an error handler and the following code which seemed to work.

    On Error GoTo Error_Handler
    On Error GoTo 0
    On Error Resume Next

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

Similar Threads

  1. Replies: 1
    Last Post: 07-30-2015, 12:56 PM
  2. Replies: 15
    Last Post: 06-29-2015, 11:12 AM
  3. Replies: 11
    Last Post: 09-17-2013, 06:29 PM
  4. Replies: 3
    Last Post: 09-09-2013, 01:48 PM
  5. Replies: 10
    Last Post: 03-26-2012, 08:17 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