By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,865 Members | 1,717 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,865 IT Pros & Developers. It's quick & easy.

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

P: 17
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?

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?


Oct 28 '08 #1
Share this Question
Share on Google+
1 Reply

P: 17

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!ChtZiekteverzuim_(incl%).Form!Year.Value = "" Then Cancel = True

End Sub

It doesn't work because Access can't find the field "ChtZiekteverzuim_(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??


Oct 29 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.