【译文】在查询里以当前月份为条件
时 间: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交流群 (群号:54525238) Access源码网店
常见问答:
技术分类:
源码示例
- 【源码QQ群号19834647...(12.17)
- Access自定义消息盒Msg...(04.28)
- Access怎么按每个月份里面...(03.09)
- Access怎么按季度来统计人...(02.26)
- Access怎么按年龄段来统计...(01.26)
- 【Access高效办公】上一年...(12.29)
- 用Access连续窗体制作的树...(11.03)
- 【Access高效办公】上一年...(10.30)
- Access制作的RGB转CM...(09.22)
- Access制作的RGB调色板...(09.15)
学习心得
最新文章
- 用VBA来指定图表中横坐标/纵坐标...(05.25)
- 还在凭感觉建表?Access建表思...(05.25)
- ACCESS视频手机上看瞎眼?用电...(05.24)
- 用SSMS将ACCESS中的表导入...(05.21)
- 自动编号用不好,系统迟早要乱!Ac...(05.21)
- Access原生开发VS快速开发:...(05.20)
- 不用记密码!用Access打造私人...(05.18)
- 如何用SSMS给SQL Serve...(05.16)
- 如何用SSMS在sql serve...(05.16)
- 多用户协作:链接Access和SQ...(05.16)


.gif)
