在新年伊始重置自动文件编号 [英] Resetting automatic File Number at start of new year

查看:86
本文介绍了在新年伊始重置自动文件编号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的订单数据库(其他人创建并且我一直在改进)中,当我输入新订单时,它使用自动编号REC_ID字段生成文件编号(即2007-0001)。我会告诉你它使用的代码。

点击按钮后会发生以下情况:

展开 | 选择 | 换行 | 行号

解决方案


在我的订单数据库(其他人创建并且我一直在改进)中,当我输入新订单时,它会生成一个文件编号(即2007-0001)使用自动编号REC_ID字段。我会告诉你它使用的代码。

点击按钮后会发生以下情况:

展开 | 选择 | 换行 | 行号


__ 1。 此过程可以通过公共函数自动执行,该函数在2个表中的任意一个表中返回最高的REC_ID,并且几乎可以在数据库中的任何位置使用:

展开 | 选择 | Wrap | 行号



我相信我理解这两者的作用。但是目前文件号是由代码中的最高REC_ID减去1的数字生成的。例如,如果2007年底的最高REC_ID是45673,那么我们必须取这个数字,减去45672,所以最终结果为1.然后它使用该1作为新文件号。我可以在tblCurrentYear中添加一个名为HighREC_ID的第二个字段,并且每次生成一个新的文件编号时都让查询引用该字段吗?

那么我可以将tblCurrentYear中的单个记录更新到新的一年并且每年年初新的最高REC_ID?


此外,有没有更好的方法让文件号在数字的开头添加适当数量的零(2007-0001 ,与2007-1; 2007-0234,与2007-234相比),而不是像目前正在使用的那样连续使用四个查询?



我的问题是否令人困惑?遗憾。


In my Orders database (which someone else created and I have been improving), when I enter a new order it generates a file number (i.e. 2007-0001) using an autonumber REC_ID field. I''ll show you the code that it uses.
The following occurs upon a button click:

Expand|Select|Wrap|Line Numbers

解决方案

In my Orders database (which someone else created and I have been improving), when I enter a new order it generates a file number (i.e. 2007-0001) using an autonumber REC_ID field. I''ll show you the code that it uses.
The following occurs upon a button click:

Expand|Select|Wrap|Line Numbers


__1. This process can be autuomated via a Public Function which returns the highest REC_ID in either 1 of 2 Tables and can be used virtually anywhere in the Database:

Expand|Select|Wrap|Line Numbers


I believe that I understand what both of those do. But currently the File Number is generated by a number within the code that is the highest REC_ID minus one. For example, if the highest REC_ID at the end of 2007 is, let''s say, 45673, then we have to take that number, subtract 45672, so the end result is 1. Then it uses that 1 as the new file number. Might I add a second field to tblCurrentYear called HighREC_ID, and have the queries reference that field each time a new File Number is generated?
Then could I have the single record in tblCurrentYear update to the new year and new highest REC_ID at the beginning of each year?

Also, is there a better way to have the file number add the appropriate number of zeros to the beginning of the number (2007-0001, versus 2007-1; 2007-0234, versus 2007-234) than by using the four queries in a row as is currently happening?

Was my question confusing? Sorry.


这篇关于在新年伊始重置自动文件编号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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