自动编号数据库中的特定字段 [英] Auto Numbering a specific field within a database

查看:67
本文介绍了自动编号数据库中的特定字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

晚上好我有一个数据库,其中我有一个命令按钮,当按下时,我想看到前一个记录/字段的值,然后加1。我从来没有构建过一个代码,我不得不向后看一部分方程式给我的价值。以下是我正在玩的内容,看看我是否可以在没有帮助的情况下使用它,但是我无法让它向后看部分价值。


应该, acLast,Me.DRAWING_NO> = 105999 ,, acNewRec,Me.DRAWING_NO = 106000

应该,acLast,Me.DRAWING_NO = Me.DRAWING_NO< = 106000 ,, acNewRec,Me.DRAWING_NO = Me .DRAWING_NO + 1



任何帮助都会很感激。


Lloyd

Good evening I have a database where I a command button that when pressed I wan to see the value from the previous record/field and then add 1 to it. I have never built a code where I had to look backwards for part of the equations to give me the value. Below is what I was playing with just to see if I could get it to work with out help, but I can not get it to look backwards for part of the value.

Should , acLast, Me.DRAWING_NO >= 105999, , acNewRec, Me.DRAWING_NO = 106000
Should , acLast, Me.DRAWING_NO = Me.DRAWING_NO <= 106000, , acNewRec, Me.DRAWING_NO = Me.DRAWING_NO + 1

I would be happy using auto number if I knew how to reset the first number it puts out instead of it being 1 I need it to start out at 10600.

Any help would be thankful.

Lloyd

推荐答案

你的代码使对我没有意义。我甚至无法判断它是SQL还是VBA :-(


但是,如果你需要确定表字段中的最高值,那么你可以使用 DMax()。因为你正在研究的整个环境是如此不清楚,现阶段我说的不多了。如果你从那里开始并回答一个更明确的问题,如果你卡住了那应该有用。
Your code makes no sense to me. I can''t even tell if it''s SQL or VBA :-(

However, if you need to determine the highest value in a table field then you could use DMax(). As the whole context you''re working in is so unclear there''s not much more I can say at this stage. If you start there and reply with a clearer question if you get stuck then that should work.


我所拥有的是一个数据库,我想为每个新条目执行自动编号功能。但我不想从1开始。我怎么能更改或获取自动编号功能来执行此操作。


上面我只是玩不同的代码(VBA)试图让我的字段查看特定字段的上一个条目和然后添加1。我希望这有帮助
What I have is a database that I want to have perform an autonumber function for each new entry. But I do not want to start out at 1. How can I change or get the autonumber feature to do this.

Above I was just playing around with different codes (VBA) trying to get my field to look at the previous entry of a specific field and then add 1 to it. I hope this helps


你不能让AutoNumber为你做这个。自动编号只保证提供唯一的值。它甚至没有规定它们是以任何顺序提供的,更不用说一个或者具有特定起始位置的。


正如我在前面的帖子中提到的,您需要使用 DMax()来确定表中包含的最高值然后加1。
You cannot get AutoNumber to do this for you. AutoNumber only guarantees to provide unique values. It never stipulates even that they are provided in any order, let alone an order with a specific starting position.

As I mentioned in the earlier post you will need to use DMax() to determine the highest value contained within the table then add 1 to that.


这篇关于自动编号数据库中的特定字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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