[access查询]在查询中返回符合指定条件的行记录
时 间:2004-04-02 00:00:00
作 者:竹笛 ID:8 城市:上海 QQ:3059255
摘 要:在查询中返回符合指定条件的行记录
正 文:
Function PlusOne(var As Variant)
Static i As Integer
i = i + 1
PlusOne = i
End Function
2、建立一查询,拖出你需要的列,增加一列:
Field Expr1: PlusOne(【MyField】) Mod 5
在总计栏选:Expression
在准则栏输入:0
3、结果将返回所有被5整除的记录
参考文章:
http://www.mvps.org
Have a query return every nth record in a table
Author(s)
Erika Yoxall
(Q) How can I write a query to return every fifth record from a table?
(A) Here's a general-purpose way to write a query to return every nth record from a table. It will choose equally-spaced records, but not start in any particular spot, i.e. it might return the 1st, 5th and 9th or 2nd, 6th and 10th records if set to a spacing of 4. First, create a new function:
Function PlusOne (var As Variant)
Static i As Integer
i = i + 1
PlusOne = i
End Function
Then, create your query. Drag down whatever fields you want to see in the output. Add one more column to the query, with these properties:
Field Expr1: PlusOne(【MyField】) Mod 5
Show No
Criteria 0
You can use any field in your output in place of MyField -- it doesn't matter which one you use. If you want every 7th record, use Mod 7, for every 10th record, use Mod 10, and so on.
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)
学习心得
最新文章
- Access自定义消息盒Msgbo...(04.28)
- Access快速开发平台--提示:...(04.23)
- Access快速开发平台--2.6...(04.20)
- 批量插入数据大幅提升速度详解(04.13)
- 如何用VBA代码结合企业微信,给微...(04.11)
- Access直播-TreeView...(04.10)
- Access直播-带您进入ACCE...(04.08)
- Access直播-ADO新增数据(04.03)
- 欢迎来Access直播间学习(03.31)
- Access快速开发平台--待处理...(03.27)


.gif)
