简体   繁体   English

MS Access多用户同时选择不同的记录

[英]MS Access Multi User Selecting Different Records Concurrently

In our multi-user Access environment, sometimes it is necessary to perform different actions on a group of records. 在我们的多用户访问环境中,有时有必要对一组记录执行不同的操作。 In the Orders table, for example, a user may want to delete a group of orders, or to print out a group of records, etc. To accomplish this, in the Orders table, I created a boolean field called aSelect (the "a" is to avoid the "Select" SQL reserved keyword). 例如,在Orders表中,用户可能要删除一组订单,或打印出一组记录,等等。为此,在Orders表中,我创建了一个名为aSelect的布尔字段(“ a ”是为了避免使用“选择” SQL保留关键字)。 On the Orders form, users can check off the orders which they want to process by clicking the checkbox for the aSelect field and then click "print", "delete", or whatever other operation. 在“订单”表单上,用户可以通过单击aSelect字段的复选框来选中要处理的订单,然后单击“打印”,“删除”或其他任何操作。 The code behind the form then says to process the operation on all Orders WHERE ASELECT=TRUE 然后,表格后面的代码说要在所有WHERE ASELECT = TRUE的订单上处理操作

The problem is that, (while it hasn't happened yet), the aSelect checkbox is bound to the underlying field in the table, and two users can change aSelect at the same time. 问题在于,(尚未发生)(aSelect复选框已绑定到表中的基础字段),并且两个用户可以同时更改aSelect。 So, suppose user A selects two records to delete, but before he hits the delete button, another user attempting to print a 100 records selects 100 records. 因此,假设用户A选择两个记录要删除,但是在他按下删除按钮之前,另一个尝试打印100条记录的用户选择了100条记录。 The result will be that all 100 records will be deleted--not the intended result. 结果是将删除所有100条记录-而不是预期的结果。

Any solutions or alternatives? 任何解决方案或替代方案? This scenario plays out numerous times throughout the database. 此方案在整个数据库中播放了无数次。 The Orders table is just one example. Orders表只是一个示例。

Thanks, 谢谢,

Create a table with a username/userid column and an OrderID column. 创建一个包含用户名/用户标识列和订单ID列的表。

When the user makes a selection, add a record to this table with the OrderID and username, then when running your query just join this selection table or use an IN() clause and filter by username. 当用户进行选择时,将带有OrderID和用户名的记录添加到该表中,然后在运行查询时,只需联接此选择表或使用IN()子句并按用户名进行过滤。

Voila - user specific selections, which could be improved/expanded upon but this is my basic offering. Voila-用户特定的选择,可以对其进行改进/扩展,但这是我的基本服务。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM