没有找到记录时,RecordCount显示不显示零 [英] RecordCount display not showing zero when no records are found

查看:57
本文介绍了没有找到记录时,RecordCount显示不显示零的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

预先感谢您的帮助。


目标:显示子表单中查询返回的结果数。


问题:如果查询没有返回结果,txtBox将继续显示最后一个记录数。


最初我在Form_Current()中有这个。

Thanks in advance for the help.

The goal: Display the number of results returned by a query in a sub form.

The problem: If the query returns no results the txtBox will continue to display the last record count.

Originally I had this in Form_Current()

展开 | 选择 | Wrap | 行号

推荐答案

有时使用Recordsets,计数将关闭,直到Recordset被导航,这可能对你有用:
Sometimes with Recordsets, the count will be off until the Recordset is navigated, maybe this will work for you:
展开 | 选择 | Wrap | 行号


我看到你用MoveLast做了什么,但这给了我同样的问题。当查询没有返回任何结果时,它仍会显示前一个数字。


编辑:旁边注释,因为你提到导航,我在表单上导航而不是子表单,当你点击记录时子窗体被重新获取的形式。
I see what you did with MoveLast but that gave me the same problem. It still displays the previous number when the query returns no results.

Side note since you mentioned navigation, I am navigating on the form not the subform, as you click through records on the form the subform is requeried.


我想我错过了你在SubForm上寻找一个RecordCount。也许试试这个,因为它得到SubForm的Recordset克隆而不是主窗体:
I think I missed that you were looking for a RecordCount on a SubForm. Maybe try this then, as it gets the Recordset Clone of the SubForm instead of the Main Form:
展开 | 选择 | Wrap | 行号


这篇关于没有找到记录时,RecordCount显示不显示零的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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