根据数据比较填充2条记录 [英] Populate 2 records based on a comparison of data

查看:69
本文介绍了根据数据比较填充2条记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Access 2000数据库,我需要在配对中更新两个记录,具体取决于数量字段值的差异。


这是表中相关数据的示例。


配对个人数量状态

AB A 15

AB B 13


CD C 13

CD D 15


EF E 14

EF F 14


每个配对总会有2个人。

每个人在数量字段中都有一个值。


我需要填写一个状态字段两个人,基于配对中每个个体的数量值之间的差异。实际差异与此状态代码无关,只有哪个个体的数量超过,小于或等于另一个人的数量。如果我需要在其他计算中使用它们,代码可以是 + 1,-1或0 。我需要的结果与此类似:


配对个人数量状态

AB A 15 M或+1

AB B 13 L或-1


CD C 13 L或-1

CD D 15 M或+1


EF E 14 E或0

EF F 14 E或0


如何在Access 2000中执行此操作?

谢谢,

I have an Access 2000 database in which I need to update both records in a pairing, based on the difference in the value of a quantity field.

This is an example of the pertinent data in the table.

Pairing Individual Quantity Status
AB A 15
AB B 13

CD C 13
CD D 15

EF E 14
EF F 14

There will always be 2 individuals per pairing.
Each individual will have a value in the quantity field.

I need to populate a status field for both individuals, based on the difference between the quantity values of each of the individuals in the pairing. The actual difference is not relevant for this status code, just which individual?s quantity is More than, Less than or Equal to the other individual?s quantity. The codes could be +1, -1 or 0 if I need to us them in other calculations. The results I need would be similar to this:

Pairing Individual Quantity Status
AB A 15 M or +1
AB B 13 L or -1

CD C 13 L or -1
CD D 15 M or +1

EF E 14 E or 0
EF F 14 E or 0

How can I do this in Access 2000?

Thanks,

推荐答案


我有一个Access 2000数据库,我需要在其中更新两个配对中的记录,基于数量字段值的差异。


这是表中相关数据的示例。


配对个人数量状态

AB A 15

AB B 13


CD C 13

CD D 15


EF E 14

EF F 14


每个配对总会有2个人。

每个人在数量字段中都有一个值。


我需要填写一个状态字段两个人,基于配对中每个个体的数量值之间的差异。实际差异与此状态代码无关,只有哪个个体的数量超过,小于或等于另一个人的数量。如果我需要在其他计算中使用它们,代码可以是 + 1,-1或0 。我需要的结果与此类似:


配对个人数量状态

AB A 15 M或+1

AB B 13 L或-1


CD C 13 L或-1

CD D 15 M或+1


EF E 14 E或0

EF F 14 E或0


如何在Access 2000中执行此操作?

谢谢,
I have an Access 2000 database in which I need to update both records in a pairing, based on the difference in the value of a quantity field.

This is an example of the pertinent data in the table.

Pairing Individual Quantity Status
AB A 15
AB B 13

CD C 13
CD D 15

EF E 14
EF F 14

There will always be 2 individuals per pairing.
Each individual will have a value in the quantity field.

I need to populate a status field for both individuals, based on the difference between the quantity values of each of the individuals in the pairing. The actual difference is not relevant for this status code, just which individual?s quantity is More than, Less than or Equal to the other individual?s quantity. The codes could be +1, -1 or 0 if I need to us them in other calculations. The results I need would be similar to this:

Pairing Individual Quantity Status
AB A 15 M or +1
AB B 13 L or -1

CD C 13 L or -1
CD D 15 M or +1

EF E 14 E or 0
EF F 14 E or 0

How can I do this in Access 2000?

Thanks,



创建一个由[Pairing],[Individual]和[Quantity]字段组成的查询。创建一个名为Status的计算字段,它将调用fReturnStatus2([Quantity])函数并为每个匹配对返回相应的返回值。所有代码都集中在函数中,仅用于演示目的。这不是获得答案的最有效方法,特别是在为每个记录填充数组时。祝你好运。

Create a Query consisting of the [Pairing], [Individual], and [Quantity] Fields. Create a Calculated Field called Status which will call the fReturnStatus2([Quantity]) Function and return the appropriate return value for each matching pair. All the code has been centralized within the Function for demo purposes only. This is not the most efficient way to arrive at the answer especially with the Arrays being populated for each Record. Good Luck.

展开 | 选择 | Wrap | 行号


非常感谢。


它''对我(和项目)有很大的帮助!!!
Thank you very much.

It''s a great help to me (and the project)!!!


ADezii,您可以从查询中调用该函数吗?每当我尝试它时,我都会收到错误,未知功能。
ADezii, you can call that function from a query? Whenever I try it I get an error, unknown function.


这篇关于根据数据比较填充2条记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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