如何在MS Access报告表中显示记录号? [英] How to show the record number in a MS Access report table?

查看:146
本文介绍了如何在MS Access报告表中显示记录号?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用MS Access制作用于办公室的一小段软件.当我们插入一条记录时,记录ID并不总是遵循自然数的顺序,从1开始.但是在第一列中,我想要一个自生成的序列号(S.N).

I'm using MS Access to make a small piece of software for an office. When we insert a record the record ID does not always follow the sequence of natural numbers, starting from 1. but in the first column I want a self-generated serial number(S.N).

SN  |   Discription |
----+---------------+
1   |   Computer    |
2   |   Mobile      |

我希望这些S.N始终从1开始,并计数报告表中的所有记录.请帮助.

I Want these S.N to always start from 1 and count all records in the report table Plsease help.

推荐答案

我假设您的表名是库存:

I assume your table name is inventory:

SELECT DCOUNT("[Description]","[inventory]","[Description]<='" & [Description] & "'") AS rank, inventory.*
FROM inventory
ORDER BY [Description]

DCOUNT函数计算满足给定条件的行数.在这种情况下,我们计算少于当前行的行数.如果您使用的列具有唯一值,那么事情就可以解决.

DCOUNT function counts the number of rows that satisfy the a given criteria. In this case we count the number of rows that are less than the current row. Things will work if the column you use has unique values.

这篇关于如何在MS Access报告表中显示记录号?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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