表格上的连续数字 [英] Sequential Numbers on Forms

查看:60
本文介绍了表格上的连续数字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个表格Job_Edit用子表单。子表单称为JobTask。是一种连续的形式,包括一个用于一系列任务的查找组合框。在我选择说4个单独的任务后,我可以按正确的顺序打印报告没问题,因为我插入了一个文本框,控制源= 1并在报告中运行总和。


但是,当我关闭表单并重新打开它时,所选任务已按其TaskID no重新排序。这当然是一个自动编号。我一直在探索DMax,甚至在每个任务旁边的文本框中手动输入一个no并尝试使用Order By。


不幸的是,这一切都证明了我的全部!理想情况下,我希望排序顺序始终是选择任务的顺序。理想情况下,如果需要一组新的数字,我希望这些数字是自动的。但是他们需要在Job_Edit中为每个工作从No.1开始。


任何帮助都非常感谢。


谢谢

I have a form "Job_Edit" with a subform. The subform called "JobTask" is a continuous form and includes a look-up combo box for a range of tasks. After I choose say 4 separate tasks, I can print a report in the correct order no problem because I inserted a text box with control source =1 and running sum in the report.

However, when I close the form and re-open it, the selected tasks have been re-ordered by their TaskID no. which of course is an autonumber. I have been exploring DMax and even manually entering a no in a text box next to each task and trying to use Order By.

Unfortunately this has all proved beyond me! Ideally, I would like the sort order to always be that in which the tasks were selected. Also ideally, if a new set of numbers is required, I would prefer these to be automatic. BUT they need to start at No.1 for each job in "Job_Edit".

Any help much appreciated.

Thank you

推荐答案


...但是,当我关闭表单并重新打开它时,所选的任务已被重新启动 - 由他们的TaskID编号。这当然是一个自动编号。我一直在探索DMax,甚至在每个任务旁边的文本框中手动输入no并尝试使用Order By。 ...
...However, when I close the form and re-open it, the selected tasks have been re-ordered by their TaskID no. which of course is an autonumber. I have been exploring DMax and even manually entering a no in a text box next to each task and trying to use Order By. ...



嗨。为了避免更改表的关键字段关系 - 如果一切正常工作将是一件非常糟糕的事情 - 我能想到的最简单的事情是解决你添加新记录的困难是添加一个新的自动编号字段EntryOrder到表,它是作业任务表单的记录源。如果作业任务基于对基础表的查询,那么添加字段后您需要做的就是在查询中包含新字段,并按升序对此字段进行排序。


如果您的作业任务表不是基于查询,则创建一个新查询,将作业任务表的所有字段添加到查询(包括新的EntryOrder字段),如上所述,按升序对此字段进行排序,然后将您的职位空缺表格的记录来源更改为这个新查询的名称。


这种方法的缺点是它可能无法克服现有的现有订单记录。它将确保所有新的作业任务都以输入顺序显示,无论这些任务是一次性添加还是批量添加。自动编号实际上只是提供一个序列号 - 它不被用作任何形式的关键字段。 EntryOrder字段不一定按连续顺序编号(1,2,3等),因为在为其他作业添加其他任务后可能会添加新任务,但即使如此,它也将按顺序编号(1,2,7) ,例如,10)。顺序性质将提供您所寻求的顺序而无需自己处理数字计数器字段的递增。


-Stewart

Hi. To avoid changing key field relationships for your tables - which would be a very bad thing to do if everything is otherwise working fine - the simplest thing I can think of which would resolve your difficulties for new records added is to add a new autonumber field called EntryOrder to the table which is the recordsource for your Job Task form. if Job Task is based on a query of the underlying table then all you need to do after adding the field is to include the new field in your query and sort on this field in ascending order.

If your Job Task table is not based on a query then create a new query, add all the fields of the Job Task table to the query (including the new EntryOrder field) and, as above, sort on this field in ascending order, then change the recordsource of your Job Entry form to the name of this new query.

A downside of this approach is that it may not do anything to overcome the current ordering of your existing records. It will ensure that all new job tasks are shown in entry order, regardless of whether the tasks are added all at once or in batches. The autonumber is really just providing a sequence number - it is not being used as any form of key field. The EntryOrder field will not necessarily be numbered in consecutive order (1, 2, 3 and so on), as new tasks may be added after adding other tasks for other jobs, but even so it will be sequentially numbered (1, 2, 7, 10, for instance). It is the sequential nature which will provide the ordering you seek without having to deal with incrementing a numeric counter field yourself.

-Stewart


谢谢非常感谢你的回复。但是,我的表不允许两个自动编号字段。主键是现有的自动编号
Thanks very much for the reply. My table will not allow two autonumber fields, however. The primary key is the existing autonumber



非常感谢您的回复。但是,我的表不允许两个自动编号字段。主键是现有的自动编号
Thanks very much for the reply. My table will not allow two autonumber fields, however. The primary key is the existing autonumber



嗨。事实上你已经拥有一个自动编号字段,虽然对我来说有点意外,但应该允许按照我的描述通过输入顺序对记录进行排序。


您是否订购了查询这个领域?还有什么能够识别任务吗?如果存在,则首先按这些其他字段排序,然后在查询中最后排序自动编号字段。然后你应该看到你的工作和入职顺序的记录。


-Stewart

Hi. The fact that you already have an autonumber field, although somewhat of a surprise to me, should allow the ordering of your records by entry order as I described.

Are you ordering your query on this field? Is there anything else which identifies tasks? If there is, order by these other fields first, then have the ordering of the autonumber field last in your query. You should then see your records in job and entry sequence.

-Stewart


这篇关于表格上的连续数字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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