Results 1 to 2 of 2
  1. #1
    caniread is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Sep 2015
    Posts
    86

    Report cancel on no data in detail section

    Is there a way to cancel the report if no data exists in the detail section only? I have it working in another report but I think my header technically has data so it doesn't cancel the report. Code I used is below.




    Private Sub Report_NoData(Cancel As Integer)
    MsgBox "There are no open ideas that match your selection(s)"
    Cancel = True
    End Sub

  2. #2
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    if a query is driving your report and you are calling it from a button click or other event

    for instance

    Code:
    if dcount"*", "SourceQuery") = 0 then
        msgbox "no data for this report"
    else
        docmd.openreport "reportname"
    endif

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

Similar Threads

  1. Replies: 6
    Last Post: 12-14-2015, 03:25 PM
  2. Columns in Report Detail Section only
    By gg80 in forum Reports
    Replies: 10
    Last Post: 08-03-2014, 07:41 PM
  3. Replies: 6
    Last Post: 03-26-2013, 12:17 PM
  4. Count in detail section of a report
    By ccordner in forum Reports
    Replies: 9
    Last Post: 02-08-2012, 06:55 AM
  5. The length of detail section of a report
    By blueraincoat in forum Reports
    Replies: 2
    Last Post: 04-06-2011, 12:24 AM

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