Closing a report with a subform, when subform is having no data?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Crombam
    New Member
    • Oct 2008
    • 17

    Closing a report with a subform, when subform is having no data?

    Hi to all,

    After searching the net for a couple of hours I just have to ask the question. How can I close a report with a subform (Pivot Chart) when this Pivot Chart is having no data?

    Explenation:
    I have a report, which displays a Pivot Chart (Subform). When clicking a command button for displaying this report a form pop-up wil appear, where one can select a dynamic date range. In this pop-up form I included a Cancel button. When the cancel button is clicked I want the pop-up form to close (that isn't hard to realize) and I want the report to close as well. Otherwise I will always get the parameter value box to ask me for the date range.
    I found out that in a normal report, not displaying a subform, you can use the No Data property. This works great. But when applying this to a report with a subform, nothing happens other than the report is being displayed with no results in the Chart.

    Can anybody help me with this problem?
    Thanks!

    Rg.

    Marco
  • Crombam
    New Member
    • Oct 2008
    • 17

    #2
    Hi,

    I can't stop thinking about this problem. I came up with the following.
    Is it possible to create an If-Then Statement where I check the value of a field in the subform and if the value is 0 then it shoudl cancel the report?

    Here the code:

    Private Sub Report_Load()

    If Me!ChtZiektever zuim_(incl%).Fo rm!Year.Value = "" Then Cancel = True

    End Sub

    It doesn't work because Access can't find the field "ChtZiekteverzu im_(incl%)". How do I refer to a field in the subform the proper way. Bear in mind that I'm now using trial and error. I simply want to check a field in the subform for a value and if so the report should be canceled or displayed.
    Hope that anyone can help??

    Rg.

    Marco

    Comment

    Working...