vba访问openreport where条件语法 [英] vba access openreport where condition syntax

查看:80
本文介绍了vba访问openreport where条件语法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想检查

,如果有任何顾客还没有归还他们的书。


所以我会检查如下:

1.检查签入日期是否为空

2.检查今天是否> duedate(意味着已经过期)

语法是开始的,以及duedate<今天


我的代码

展开 | 选择 | Wrap < span class =codeDivider> | 行号

解决方案

< blockquote>第7行中有很多问题。为了清晰起见,添加了换行符和一些braketing,第7行更正为:

展开 | 选择 | Wrap | 行号


感谢您的更正,但它说,

microsoft access无法找到字段|在你的表达式中引用。


如果不知道你引用的错误信息在什么情况下发生,我就不能轻易评论。我看不出有什么理由与我建议的修正有关,所以我怀疑它是完全负责的其他东西。


您是否尝试过编译模块(来自VBA) IDE)?如果它成功编译,代码中的哪一行会发生错误?在调用OpenReport方法时,是否控制me.today包含相关值?您是否可以在Access窗口中正常运行报告而没有错误?


请注意,应该使用Date()函数代替Now()您在代码中的功能。 Now()包括时间 - Date()只是当前日期。另外,我认为你的where子句应该只是指当前日期

展开 | 选择 | Wrap | 行号


i am trying to check
if any patrons has not returned their books yet.

so I would check as follows:
1. check if checked in date is null
2. check if today > duedate ( that means overdue)
the syntax was swtich to duedate < today


my code

Expand|Select|Wrap|Line Numbers

解决方案

Quite a mix of problems in line 7. With a line break and some braketing added for clarity, line 7 corrected is:

Expand|Select|Wrap|Line Numbers


thanks for the correction , but it said ,
microsoft access cannot find the field "|" referred in your expression.


WIthout knowing in what context the error message you quote occured I can''t easily comment. I cannot see any reason why this would be related to the correction I suggested, so I suspect it is something else entirely which is responsible.

Have you tried compiling the module (from the VBA IDE)? If it compiles successfully, on what line in your code does the error occur? Does control me.today contain a relevant value when the OpenReport method is called? Can you run the report itself as normal just from the Access window with no errors?

Please note that there is a Date() function which should be used in place of the Now() function you have in your code. Now() includes the time - Date() is just the current date. In addition, I think your where clause should really just be referring to the current date

Expand|Select|Wrap|Line Numbers


这篇关于vba访问openreport where条件语法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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