如何在msaccess中生成自动编号 [英] how to generate auto number in msaccess

查看:102
本文介绍了如何在msaccess中生成自动编号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我在ms访问中有一个表,名为"tblDBUser",其中有字段

intDBUserId,strLogin,strName,strPassword,intRoleType

我写了一个查询,我希望intDBUserID每次添加时都增加一个
表格中的新记录

这是代码....................



Hello all,

i have a table in ms access, named as "tblDBUser" where i had fields

intDBUserId,strLogin,strName,strPassword,intRoleType

i write a query in which i want intDBUserID should increment by one every time i add
the new recrd in the table

here is the code....................



INSERT INTO tblDBUser ( intDBUserId, strLogin, strName, strPassword, intDBRoleType )
VALUES (iif([select Max(intDBUserId) from tblDBUser],intDBUserId+1,0), strLogin, strName, strPassword, intDBRoleType);



但是问题是intDBUserId没有增加
请帮帮我


谢谢和问候
subiya



but problem is intDBUserId is not incremented
please help me out


thanks and regard
subiya

推荐答案

在此处查找上述问题,并阅读有关自动编号的信息:
http://www.databasedev.co.uk/automatically_increment_value.html [ http://www.databasedev.co.uk/autonumber.html [ http://blogs.office.com/b/microsoft-access/archive/2010/04/02/power-tip-create-an-autonumber-field-that-starts- with-a-number-greater-than-1.aspx [
Look here for the above question and read about autonumbers:
http://www.databasedev.co.uk/automatically_increment_value.html[^]
http://www.databasedev.co.uk/autonumber.html[^]
http://blogs.office.com/b/microsoft-access/archive/2010/04/02/power-tip-create-an-autonumber-field-that-starts-with-a-number-greater-than-1.aspx[^]


为什么不对intDBUserId使用AutoNumber?


这篇关于如何在msaccess中生成自动编号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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