如果报告查询为空,则关闭报告 [英] if report query is empty, close report

查看:71
本文介绍了如果报告查询为空,则关闭报告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

简单的方法是在报告的On No Data事件中放置cancel = True。但是为什么要在所有报告中复制代码呢?我的应用程序从列表框中选择报告,因此我更愿意检查查询的记录计数,如果为0,则永远不会访问DoCmd.OpenReport行。这是代码(案例2是我想检查报表查询是否有数据,我的DCount尝试不起作用):

展开 | 选择 | Wrap | 行号

解决方案

@tuxalot


我认为您可能需要一些小技巧才能获得所需的结果:

  1. 以某种方式定义所需的报告,以y为单位我们的例子是一个列表框:

    展开 | 选择 | Wrap | < span class =codeLinkonclick =LineNumbers(this);>行号


太棒了。再次感谢ADezii。


@tuxalot


非常欢迎您, tuxalot

The easy way is to put cancel = True in the On No Data event of the report. But why replicate code across all reports that way? My app selects reports from a listbox, so I would prefer to check the record count of the query, and if 0, never get to the DoCmd.OpenReport line. Here''s the code (case 2 is where I would like to check if the report query has data, and my DCount attempt is not working):

Expand|Select|Wrap|Line Numbers

解决方案

@tuxalot
I think you may require a little trickery to get the desired results:

  1. Define the desired Report in some manner, in your case a List Box:

    Expand|Select|Wrap|Line Numbers


fantastic. Thanks again ADezii.


@tuxalot
You are quite welcome, tuxalot.


这篇关于如果报告查询为空,则关闭报告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆