自动分配(排序)增量数字 [英] Automatically assign (sort of) incremental numbers

查看:97
本文介绍了自动分配(排序)增量数字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨 - 我在Access 2000工作。我有一个奇怪的工作订单编号系统,我想知道是否有一种方法可以让Access分配下一个增量新订单的编号。我一直在阅读主题: http://www.thescripts。 com / forum / thre ... gn + number.html ,这很有用,但这里是我正在使用的系统:从30100开始,数到30999.然后跳到40100 ,并计数到40999.现在跳到50100.依此类推。


我不问为什么,我只写代码。但为此,我需要一些帮助!


Angi

Hi - I''m working in Access 2000. I''ve got a strange numbering system for work orders, and I''m wondering if, nonetheless, there''s a way to get Access to assign the next incremental number for a new order. I''ve been reading the thread: http://www.thescripts.com/forum/thre...gn+number.html , which is helpful, but here''s the system I''m working with: Start at 30100, and count up to 30999. Then jump to 40100, and count to 40999. Now jump to 50100. And so on.

I do not ask why, I only write code. But for this, I need some help!

Angi

推荐答案

$ b $嗨 - 我在Access 2000工作。我有一个奇怪的工作订单编号系统,我想知道是否有一种方法可以让Access分配下一个增量号码新订单。我一直在阅读主题: http://www.thescripts。 com / forum / thre ... gn + number.html ,这很有用,但这里是我正在使用的系统:从30100开始,数到30999.然后跳到40100 ,并计数到40999.现在跳到50100.依此类推。


我不问为什么,我只写代码。但为此,我需要一些帮助!


Angi
Hi - I''m working in Access 2000. I''ve got a strange numbering system for work orders, and I''m wondering if, nonetheless, there''s a way to get Access to assign the next incremental number for a new order. I''ve been reading the thread: http://www.thescripts.com/forum/thre...gn+number.html , which is helpful, but here''s the system I''m working with: Start at 30100, and count up to 30999. Then jump to 40100, and count to 40999. Now jump to 50100. And so on.

I do not ask why, I only write code. But for this, I need some help!

Angi



假设表名为tblOrders,字段名称为[OrderID] {LONG},以下Public Functioin应该指向正确的方向,只需填写缺失的部分并让我知道你是如何做出的:

Assuming a Table Name of tblOrders, and a Field Name of [OrderID] {LONG}, the following Public Functioin should point you in the right direction, just fill in the missing pieces and let me know how you make out:

展开 | 选择 | Wrap | 行号



假设表名为tblOrders,字段名称为[OrderID] {LONG},以下Public Functioin应指向您正确的方向,只是填写缺失的部分,让我知道你是怎么做出来的:
Assuming a Table Name of tblOrders, and a Field Name of [OrderID] {LONG}, the following Public Functioin should point you in the right direction, just fill in the missing pieces and let me know how you make out:
展开 | 选择 | Wrap | 行号



这听起来不错,但我在哪里放呢?我之前只使用过Private Sub语句,你可以通过属性框选择事件发生的地点和时间(表格''当前''或控件''点击''等事件程序,等等。),当你最终进入VB屏幕时,它已经被设置,例如,Private Sub Form_On Current()。如何处理公共功能代码?


表单名为添加作业。该表是1 JOB,该字段是JobNumber。
This sounds good, but where do I put it? I''ve only ever worked with Private Sub statements, where you pick where and when the event will occur through the properties box (event procedure of a form ''on current'' or of a control ''on click'', etc.), and when you end up in the VB screen, it''s already set up, for instance, "Private Sub Form_On Current()". What do I do with the public function code?

The form is named "Add Job". The table is "1 JOB", and the field is "JobNumber".



在设计模式中选择JobNumber字段==>右键单击==>属性==>数据标签==>将默认值属性设置为 = fIncrementOrderNumber()。现在,当添加新记录时,将执行该功能,顺序中的下一个数字将自动添加到JobNumber字段。

Select the JobNumber Field in Design Mode ==> Right Click ==> Properties ==> Data Tab ==> set the Default Value Property to =fIncrementOrderNumber(). Now, when ever a New Record is added, the Function will be executed, and the next number in sequence will automatically be added to the JobNumber Field.


这篇关于自动分配(排序)增量数字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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