【译文】在查询里以当前月份为条件
时 间:2012-04-23 08:47:28
作 者:周芳 ID:24526 城市:上海
摘 要:创建一个查询返回当月的所有日期的记录
正 文:
原作者:Juan Soto 翻译:周芳
【译文】在查询里以当前月份为条件
那天,我需要创建一个查询返回当月的所有日期的记录。我不想编程使用开始日期和结束日期来查询,所以我想出了下面代码行,你可以直接粘贴到你的查询代码中:
Between CDate(Month(Date()) & “/1/” & Year(Date())) And DateAdd(“m”,1,CDate(Month(Date()) & “/1/” & Year(Date())))-1
以上使用“Between And”的标准是计算当前日期的月初和月底。希望大家受用!
【原文】Criteria for the current month in a query
The other day I needed to create a query where it returns all records with dates for the current month. I did not want to hard code the beginning and ending dates in the query, so I came up with the following line of code you can paste into your query:
Between CDate(Month(Date()) & “/1/” & Year(Date())) And DateAdd(“m”,1,CDate(Month(Date()) & “/1/” & Year(Date())))-1
The criteria line above uses the “Between And” operators to calculate the first of the month and the end of the month of the current date. Enjoy!
Access软件网QQ交流群 (群号:483923997) Access源码网店
常见问答:
技术分类:
源码示例
- 【源码QQ群号19834647...(12.17)
- 【Access小作品】简单的待...(04.30)
- 【Access窗体导出PDF】...(04.08)
- 【Access窗体导出PDF】...(04.07)
- Access两种方式实现即时更...(03.01)
- Access隐藏与显示lacc...(01.12)
- 【Access高效办公】将每个...(12.23)
- Access21点游戏源代码(12.13)
- 【Access窗体导出Exce...(11.15)
- 【Access开发】Acces...(11.14)
学习心得
最新文章
- 【Access小作品】简单的待办任...(04.30)
- 从另一个ACCESS数据库批量导入...(04.29)
- Access日期格式的数据导出Ex...(04.28)
- ACCESS精华集锦资料.CHM(04.25)
- Access VBA语句If Me...(04.24)
- 【Access修改记录示例】编辑选...(04.22)
- 【Access表名称命名建议】将A...(04.20)
- Access学习笔记--用Acce...(04.19)
- 【Access重复项查询示例】将A...(04.17)
- Access快速开发平台企业版--...(04.16)