替代使用Autonumber [英] Alternative to using Autonumber

查看:62
本文介绍了替代使用Autonumber的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道在Access表单中使用的代码,它可以替代使用自动编号。我的源表名为tblHelp Desk Tickets,我的号码表名为​​tblNextNum。我用来获取下一个数字的字段是NextNumber。表单上的控件框名为Helpdesk Ticket No,txtHelpdesk Ticket No.


会在这方面获得任何帮助,我对创建代码并不熟悉。当我点击创建票据按钮时,还想要弹出票号,所以我不知道代码屏幕中的哪个位置甚至可以输入这些信息。


非常感谢很多,

Johnny

I would like to know the code to use in an Access form that would be an alternative to using autonumber. My source table is called tblHelp Desk Tickets and my number table is called tblNextNum. The field I am using to for the next number to be pulled from is NextNumber. The control box on the form is called Helpdesk Ticket No, txtHelpdesk Ticket No.

Would apprecaite any help in this area, I am not that familiar with creating codes. Would also like the ticket number to pop in when I click on the create ticket button, so I don''t know where within the code screen to even put this information.

Thanks so much,
Johnny

推荐答案


我想知道要使用的代码一个Access表单,可以替代使用自动编号。我的源表名为tblHelp Desk Tickets,我的号码表名为​​tblNextNum。我用来获取下一个数字的字段是NextNumber。表单上的控件框名为Helpdesk Ticket No,txtHelpdesk Ticket No.


会在这方面获得任何帮助,我对创建代码并不熟悉。当我点击创建票据按钮时,还想要弹出票号,所以我不知道代码屏幕中的哪个位置甚至可以输入这些信息。
I would like to know the code to use in an Access form that would be an alternative to using autonumber. My source table is called tblHelp Desk Tickets and my number table is called tblNextNum. The field I am using to for the next number to be pulled from is NextNumber. The control box on the form is called Helpdesk Ticket No, txtHelpdesk Ticket No.

Would apprecaite any help in this area, I am not that familiar with creating codes. Would also like the ticket number to pop in when I click on the create ticket button, so I don''t know where within the code screen to even put this information.



您应该能够创建一个返回下一个数字并更新tblNextNum的公共函数。然后,根据表单的工作方式,可能是以下之一:

  • 在创建按钮的单击事件中,将函数返回的值分配给票号控件。
  • 执行操作表格中的类似内容插入前插入后事件。
  • 也许只需将功能名称设置为[中的票号字段的默认值]。 tblHelp桌面门票]。如果它达到你想要的,这可能是最简单的。

  • 你还没有真正说出你希望它如何工作。

    您想重复使用任何已完成的数字吗?

    您是否只想继续向上计数?

    答案取决于答案这个问题。
    You haven''t really said exactly how you want it to work.
    Do you want to reuse any number that gets finished with?
    Do you just want to keep counting upwards infinitely?
    The answer would depend on the answer to this question.



    你还没有真正说出你希望它如何工作。

    你想重用任何已完成的数字吗?

    你是否只想继续向上计数?

    答案取决于这个问题的答案。
    You haven''t really said exactly how you want it to work.
    Do you want to reuse any number that gets finished with?
    Do you just want to keep counting upwards infinitely?
    The answer would depend on the answer to this question.



    True。还有,我忘了提一下。不确定它在Access环境中的重要性,但任何执行我提到的数字代码的公共函数都应该在单独的事务中完成。换句话说,它应该 BeginTrans ,生成/更新下一个数字值,然后 CommitTrans 。并且这部分过程应该尽快完成,以减少对控制记录的争用。

    True. also, something I forgot to mention. Not sure how important it will be in the Access environment, but any public function which does the number-generation stuff I mentioned, should do it in a separate transaction. In other words, it should BeginTrans, generate/update the next-number value, then CommitTrans. And this part of the process should be done as quickly as possible, to reduce contention for the control record.


    这篇关于替代使用Autonumber的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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