I am having troubles making the On No Data Event close a report if it has No Data. Can anyone help me... I just get a message saying that the report cannot be closed whilst it is processing (opening)...
John - thanks - half way there I think. I am opening the report from a form (cmd button OnClick procedure). The report did not open, but I got a error message because I used DoCmd to open the report and then cancelled it On No Data like you suggested, Any ideas.? Should I put an OnError in the On No Data Event? or is there something else I can do.
What I have actually done whilst waiting for response was to add a non visible text box to the report. If the OnNoData event is true I set the value of this text box to "NoData". Then in the Page event of the report I closed the report if the text box value = "NoData"
This is clearly not the best way of doing it, but it did get around my problem. I just want to find out the best way.
Jo - It may not be an elegant solution, but I've always used error trapping for this.
Err_CmdPreview_Click:
If Err = 2501 Then
Err.Clear 'If report is closed because there's no data,
'don't report an error
Else
MsgBox Err.Description
End If
Resume Exit_CmdPreview_Click
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.