Results 1 to 4 of 4
  1. #1
    2 Star Lounger
    Join Date
    Apr 2008
    Posts
    188
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I have a report that contains a subreport. Some times the subreport contains no data.

    Is there a way to generate a message that will appear on the report when there is no data in the subreport?

    Thanks,

    Paul

  2. #2
    Super Moderator
    Join Date
    Aug 2001
    Location
    Evergreen, CO, USA
    Posts
    6,623
    Thanks
    3
    Thanked 60 Times in 60 Posts
    You should be able to write code that will execute on the subreport NoData Event that could populate another control on the main report to indicate there is no data in the subreport. You may have issues if you try to place that control on the subreport, but that's also worth a try, and seems a bit more elegant.
    Wendell

  3. #3
    5 Star Lounger AndrewKKWalker's Avatar
    Join Date
    Apr 2001
    Location
    Cambridge, UK
    Posts
    1,020
    Thanks
    0
    Thanked 3 Times in 3 Posts
    I am not sure if the Sub Reports NO Data Event triggers properly when there is NO data.
    Also checking for data on the Format Event of the detail Band of the Parent Report
    does not detect No Data in the same way that it appears to on a Form.

    However, as a NON Code solution you could use
    a text box on the Main Report using an IIF and DCOUNT Function with the following Syntax

    =IIf(DCount("*","SubReportQuery","SubLinkField='" & [ParentLinkField] & "'")=0,"NO SUB DATA MESSAGE","")


    Note IF the link field is Numeric you do NOT need to Concatenate
    the ' onto the ends of the Criteria.


    Andrew

  4. #4
    2 Star Lounger
    Join Date
    Apr 2008
    Posts
    188
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks for the ideas. I'll try to get it to work as soon as I have time.

    Paul

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •